Warning Statement to Delete Macro

  • Thread starter Thread starter John M
  • Start date Start date
J

John M

Hello,

I want to create a delete row macro button in a
spreadsheet for several users and want to add a warning
comment such as "Are you sure you want to delete this
row?". I do not know VB very well. Can someone help me
with this code? Thanks.

John
 
John, how about something like this, assign it to a button on your sheet

Sub test()
Msg = "Are You Sure You Want To Delete Row 2 ?"
Title = "Continue ?"
Response = MsgBox(Msg, vbYesNoCancel + vbQuestion, Title)

If Response = vbNo Then
Exit Sub
End If

If Response = vbCancel Then
Exit Sub
End If
Rows("2:2").Delete Shift:=xlUp

End Sub

--
Paul B
Always backup your data before trying something new
Using Excel 97 & 2000
Please post any response to the newsgroups so others can benefit from it
** remove news from my email address to reply by email **
 
Back
Top