Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-19-2011, 07:22 PM
mark-gabb mark-gabb is offline confirmation popup on excel sheet macro Windows XP confirmation popup on excel sheet macro Office 2007
Novice
confirmation popup on excel sheet macro
 
Join Date: Nov 2011
Posts: 17
mark-gabb is on a distinguished road
Talking 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?
Reply With Quote
  #2  
Old 12-20-2011, 08:02 AM
Catalin.B Catalin.B is offline confirmation popup on excel sheet macro Windows Vista confirmation popup on excel sheet macro Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

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
Reply With Quote
  #3  
Old 12-21-2011, 03:21 PM
mark-gabb mark-gabb is offline confirmation popup on excel sheet macro Windows XP confirmation popup on excel sheet macro Office 2007
Novice
confirmation popup on excel sheet macro
 
Join Date: Nov 2011
Posts: 17
mark-gabb is on a distinguished road
Default

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
Reply With Quote
  #4  
Old 12-22-2011, 01:16 AM
Catalin.B Catalin.B is offline confirmation popup on excel sheet macro Windows Vista confirmation popup on excel sheet macro Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

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")
Reply With Quote
Reply

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
confirmation popup on excel sheet macro Insert Excel sheet markg2 Word 1 12-15-2010 12:19 PM
confirmation popup on excel sheet macro Any tutorial same as to this excel sheet with code? Learner7 Excel 1 05-18-2010 05:31 PM
confirmation popup on excel sheet macro 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

Other Forums: Access Forums

All times are GMT -7. The time now is 11:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft