![]() |
Confirming a deletion
Hi, I am very new to writing Macro's, etc, so hopefully this will be a easy question for all you experts! I have a spreadsheet with several rows of data, that occassionally, single row will need to be deleted from. I want a confirmation messag to come up when the row is selected for deletion with something lik "Are you sure you want to delete?" Can this be done without knowing exactly which row is going to b chosen for deletion? Thanks -- Craz ----------------------------------------------------------------------- Crazy's Profile: http://www.excelforum.com/member.php...nfo&userid=825 View this thread: http://www.excelforum.com/showthread.php?threadid=38260 |
Confirming a deletion
Crazy, try this,
Sub delete_row() Msg = "Do Your Want To Delete Row " & ActiveCell.Row & " ?" Title = "Delete Row ?" Response = MsgBox(Msg, vbYesNo + vbQuestion, Title) If Response = vbNo Then Exit Sub ' Quit the macro End If ActiveCell.EntireRow.Delete End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Crazy" wrote in message ... Hi, I am very new to writing Macro's, etc, so hopefully this will be an easy question for all you experts! I have a spreadsheet with several rows of data, that occassionally, a single row will need to be deleted from. I want a confirmation message to come up when the row is selected for deletion with something like "Are you sure you want to delete?" Can this be done without knowing exactly which row is going to be chosen for deletion? Thanks! -- Crazy ------------------------------------------------------------------------ Crazy's Profile: http://www.excelforum.com/member.php...fo&userid=8251 View this thread: http://www.excelforum.com/showthread...hreadid=382603 |
All times are GMT +1. The time now is 03:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com