Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default add a warning before running a macro

i have recorded a macro that clears the contents of the unprotected unlock
cells. i would like to have a message asking if the user is sure that they
want to clear the contents or not to. is this possible?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default add a warning before running a macro

Option Explicit
Sub YourMacHere()
Dim resp as long
resp = msgbox(prompt:="Are you sure?", buttons:=vbyesno)
if resp = vbno then
exit sub
end if

'rest of your code
End Sub



Picman wrote:

i have recorded a macro that clears the contents of the unprotected unlock
cells. i would like to have a message asking if the user is sure that they
want to clear the contents or not to. is this possible?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default add a warning before running a macro

thanks Dave, sorry i'm not all that experienced with these kinds of
modifications, how would i implement your code?

"Dave Peterson" wrote:

Option Explicit
Sub YourMacHere()
Dim resp as long
resp = msgbox(prompt:="Are you sure?", buttons:=vbyesno)
if resp = vbno then
exit sub
end if

'rest of your code
End Sub



Picman wrote:

i have recorded a macro that clears the contents of the unprotected unlock
cells. i would like to have a message asking if the user is sure that they
want to clear the contents or not to. is this possible?


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default add a warning before running a macro

You have existing code for your macro, right?

You'd copy the guts that I wrote and paste it into your procedure--right near
the top, before anything really important.

Dim resp as long
resp = msgbox(prompt:="Are you sure?", buttons:=vbyesno)
if resp = vbno then
exit sub
end if


Are the only lines you'd want to paste (without those symbols, of course).

Picman wrote:

thanks Dave, sorry i'm not all that experienced with these kinds of
modifications, how would i implement your code?

"Dave Peterson" wrote:

Option Explicit
Sub YourMacHere()
Dim resp as long
resp = msgbox(prompt:="Are you sure?", buttons:=vbyesno)
if resp = vbno then
exit sub
end if

'rest of your code
End Sub



Picman wrote:

i have recorded a macro that clears the contents of the unprotected unlock
cells. i would like to have a message asking if the user is sure that they
want to clear the contents or not to. is this possible?


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default add a warning before running a macro

That worked perfectly, thanks very much

"Dave Peterson" wrote:

You have existing code for your macro, right?

You'd copy the guts that I wrote and paste it into your procedure--right near
the top, before anything really important.

Dim resp as long
resp = msgbox(prompt:="Are you sure?", buttons:=vbyesno)
if resp = vbno then
exit sub
end if


Are the only lines you'd want to paste (without those symbols, of course).

Picman wrote:

thanks Dave, sorry i'm not all that experienced with these kinds of
modifications, how would i implement your code?

"Dave Peterson" wrote:

Option Explicit
Sub YourMacHere()
Dim resp as long
resp = msgbox(prompt:="Are you sure?", buttons:=vbyesno)
if resp = vbno then
exit sub
end if

'rest of your code
End Sub



Picman wrote:

i have recorded a macro that clears the contents of the unprotected unlock
cells. i would like to have a message asking if the user is sure that they
want to clear the contents or not to. is this possible?

--

Dave Peterson


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro warning - how to delete macro GavinS Excel Worksheet Functions 3 April 1st 09 01:45 PM
Get Macro warning, but can't find Macro Stilla Excel Worksheet Functions 1 January 20th 07 01:27 AM
Macro Warning Ted Dawson New Users to Excel 3 February 25th 06 05:49 PM
Macro warning box Quaisne Excel Discussion (Misc queries) 4 October 13th 05 07:45 AM
macro warning gls858 New Users to Excel 12 February 16th 05 11:09 PM


All times are GMT +1. The time now is 01:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"