C
C. Campbell
I have a workbook with two sheets. There is a button on each sheet
with code to erase a named range without deleting areas that aren't
included in the range.
If I press a button, the code executes OK. Then when I go to the
other sheet I can't press the second button. Also, sometimes I can't
select it in design mode. Actually, I can select the button but when
I right-click it and select "Properties", it gives me the sheet
properties instead of the button properties.
What am I doing wrong?
Here is the button code:
Sub CommandButton1_Click()
'Erase data in Overtime Report sheet
vAnswer = msgbox("This will erase all your data but not the formulas.
Continue?", vbYesNo)
If vAnswer = vbYes Then
Application.Goto Reference:="OTDataEntry"
Selection.ClearContents
End If
Range("A1").Select
Range("E7").Select
End Sub
------------------------------------------
Sub CommandButton2_Click()
'Erase data in HOURS sheet
vAnswer = msgbox("This will erase all your data but not the formulas.
Continue?", vbYesNo)
If vAnswer = vbYes Then
Application.Goto Reference:="DataEntry"
Selection.ClearContents
End If
Range("A1").Select
Range("G3").Select
End Sub
with code to erase a named range without deleting areas that aren't
included in the range.
If I press a button, the code executes OK. Then when I go to the
other sheet I can't press the second button. Also, sometimes I can't
select it in design mode. Actually, I can select the button but when
I right-click it and select "Properties", it gives me the sheet
properties instead of the button properties.
What am I doing wrong?
Here is the button code:
Sub CommandButton1_Click()
'Erase data in Overtime Report sheet
vAnswer = msgbox("This will erase all your data but not the formulas.
Continue?", vbYesNo)
If vAnswer = vbYes Then
Application.Goto Reference:="OTDataEntry"
Selection.ClearContents
End If
Range("A1").Select
Range("E7").Select
End Sub
------------------------------------------
Sub CommandButton2_Click()
'Erase data in HOURS sheet
vAnswer = msgbox("This will erase all your data but not the formulas.
Continue?", vbYesNo)
If vAnswer = vbYes Then
Application.Goto Reference:="DataEntry"
Selection.ClearContents
End If
Range("A1").Select
Range("G3").Select
End Sub