Dim response
response = MsgBox(prompt:="ok or cancel", Buttons:=vbOKCancel)
If response < vbOK Then
For i = 1 To Worksheets.Count + 3
Range("Q" & i + 10) = ""
Next
'
Range("A2:A32,C2:C32,D2:D32,E2:E32,H2:H32").ClearC ontents
Range("A2").Select
End If
End Sub
Is that what you want?
--
HTH
RP
(remove nothere from the email address if mailing direct)
"bbc1" wrote in message
...
This is what my script looks like now and it still deletes all data if
cancel
is pushed
Dim response
response = MsgBox(prompt:="ok or cancel", Buttons:=vbOKCancel)
If response < 2 Then
For i = 1 To Worksheets.Count + 3
Range("Q" & i + 10) = ""
Next
End If
'
Range("A2:A32,C2:C32,D2:D32,E2:E32,H2:H32").Select
Range("H2").Activate
Selection.ClearContents
Range("A2").Select
End Sub
"Bryan Hessey" wrote:
try extracting from:
Dim response
response = MsgBox(prompt:="ok or cancel", Buttons:=vbOKCancel)
If response < 2 Then
For i = 1 To Worksheets.Count + 3
Range("Q" & i + 10) = ""
Next
End If
that should help
bbc1 Wrote:
Have a button on worksheet that clears certain cells on the sheet,
would
like
that a message box pops up when pressed asking user for confirmation,
have
added below to the script on button but it clears cells regardless
wether you
say O/k or cancel need reposne to O/k "clears cells" or cancel " does
not
clear cells"
Dim response As Long
response = MsgBox(prompt:="ok or cancel", Buttons:=vbOKCancel)
'
Range("A2:A32,C2:C32,D2:D32,E2:E32,H2:H32").Select
Range("H2").Activate
Selection.ClearContents
Range("A2").Select
End Sub
--
Bryan Hessey
------------------------------------------------------------------------
Bryan Hessey's Profile:
http://www.excelforum.com/member.php...o&userid=21059
View this thread:
http://www.excelforum.com/showthread...hreadid=395724