ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Warning Statement to Delete Macro (https://www.excelbanter.com/excel-programming/283570-warning-statement-delete-macro.html)

John M[_5_]

Warning Statement to Delete Macro
 
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

Don Guillett[_4_]

Warning Statement to Delete Macro
 
Take a look in vbe HELP indes for inputbox

--
Don Guillett
SalesAid Software

"John M" wrote in message
...
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




Paul B[_7_]

Warning Statement to Delete Macro
 
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 **

"John M" wrote in message
...
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





All times are GMT +1. The time now is 08:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com