elwayisgod
asked on
Clear a Range in VBA - Excel 2007
Hi,
In the below code before it retrieves the data I need it to clear the data that is in a range named 'ClearDataRange'.
'ActiveSheet.Unprotect
X = EssVSetSheetOption(Null, 5, 1)
Y = EssVSetSheetOption(Null, 11, True)
X = EssVSetSheetOption(Null, 12, False)
X = EssVSetSheetOption(Null, 13, True)
X = EssVSetSheetOption(Null, 14, "Default")
X = EssVSetSheetOption(Null, 18, False)
X = EssVSetSheetOption(Null, 24, False)
X = EssVSetSheetOption(Null, 25, False)
X = EssVRetrieve(Null, Range("Retrieve_Data"), 1)
If X = 0 Then
MsgBox (" Data Retrieve Successful.")
Else
MsgBox ("Retrieve Failed. Please try again.")
End If
Range("C15").Select
'ActiveSheet.Protect
End Sub
In the below code before it retrieves the data I need it to clear the data that is in a range named 'ClearDataRange'.
Sub GetData()'ActiveSheet.Unprotect
X = EssVSetSheetOption(Null, 5, 1)
Y = EssVSetSheetOption(Null, 11, True)
X = EssVSetSheetOption(Null, 12, False)
X = EssVSetSheetOption(Null, 13, True)
X = EssVSetSheetOption(Null, 14, "Default")
X = EssVSetSheetOption(Null, 18, False)
X = EssVSetSheetOption(Null, 24, False)
X = EssVSetSheetOption(Null, 25, False)
X = EssVRetrieve(Null, Range("Retrieve_Data"), 1)
If X = 0 Then
MsgBox (" Data Retrieve Successful.")
Else
MsgBox ("Retrieve Failed. Please try again.")
End If
Range("C15").Select
'ActiveSheet.Protect
End Sub
ASKER
Yep. And it took my formatting with it :( Forgot to put that stipulation in there :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect Thanks!!!
Range("ClearDataRange").Cl
Kyle