#1
|
|||
|
|||
confirmation popup on excel sheet macro
hey guys
i have a macro that deletes an entire row of information, but i want to make it so that when you click on the button a popup box pops up and asks "are you sure you want to delete the information for %c4%" "yes or no" doesnt anyone know the code i would have to enter for this? |
#2
|
|||
|
|||
You can try this:
Code:
sub deleteCells() Dim Ask As Integer Ask = MsgBox(Prompt:="Is this What you want?", _ Buttons:=vbYesNo, Title:="Confirmation required") If Ask = vbYes Then 'delete your range activesheet.range("A1:A10").clearContents Else MsgBox "Cancelled by user..." Exit Sub End If end sub |
#3
|
|||
|
|||
that is awesome and perfect, it does exactly as i want....thank you caitlin
one more question this is a list of people with there details is there any way i can make it say "are you sure you want to delete <insert name>?" the name is in the F column |
#4
|
|||
|
|||
There are lots of possibilities...Change the line:
Code:
Ask = MsgBox(Prompt:="Is this What you want?"& vbNewLine & _ activesheet.cells(1,"F") & " will be deleted!", Buttons:=vbYesNo, Title:="Confirmation required") |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Debug for macro run through button only when sheet protected | leahca | Excel Programming | 0 | 11-24-2011 04:47 AM |
Insert Excel sheet | markg2 | Word | 1 | 12-15-2010 12:19 PM |
Any tutorial same as to this excel sheet with code? | Learner7 | Excel | 1 | 05-18-2010 05:31 PM |
Excel sheet Sequence Number | belloffice | Excel | 1 | 02-25-2010 02:41 PM |
copy cell from sheet 2 to sheet 3 macro | slipperyjim | Excel Programming | 1 | 02-18-2010 01:31 AM |