ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding a Confirmation Step to Macro (https://www.excelbanter.com/excel-programming/294065-adding-confirmation-step-macro.html)

saturnin02[_2_]

Adding a Confirmation Step to Macro
 
Hi,
I got this Macro off of DmcRitchie's web site.
It removes all formulas from a workbook (pasting as values)
How can I ADD a CONFIRMATION STEP that will bring up dialog box saying
(something like):
"Are you sure you want to strip all formulas form this workbook?"
Yes and No Buttons
Let me know if easy to do.
Tx,
S

Sub Remove_All_Formulas_In_All_Sheets 'No_formula_Macro()
'Goodnight 2000-10-27 programming -- Striping a workbook of formulas
Dim SH As Worksheet
For Each SH In Worksheets
SH.Activate
Application.ScreenUpdating = False
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:= False, Transpose:=False
Next
End Sub



Bob Phillips[_6_]

Adding a Confirmation Step to Macro
 
Sub Remove_All_Formulas_In_All_Sheets 'No_formula_Macro()
'Goodnight 2000-10-27 programming -- Striping a workbook of formulas
Dim SH As Worksheet
Dim ans As Long

ans = MsgBox("Are you sure you want to strip all formulas form this
workbook?", vbYesNo)
If ans =, vbYes Then
For Each SH In Worksheets
SH.Activate
Application.ScreenUpdating = False
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:= False, Transpose:=False
Next
End If
End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"saturnin02" <saturnin02_at_hotmail.com wrote in message
...
Hi,
I got this Macro off of DmcRitchie's web site.
It removes all formulas from a workbook (pasting as values)
How can I ADD a CONFIRMATION STEP that will bring up dialog box saying
(something like):
"Are you sure you want to strip all formulas form this workbook?"
Yes and No Buttons
Let me know if easy to do.
Tx,
S

Sub Remove_All_Formulas_In_All_Sheets 'No_formula_Macro()
'Goodnight 2000-10-27 programming -- Striping a workbook of formulas
Dim SH As Worksheet
For Each SH In Worksheets
SH.Activate
Application.ScreenUpdating = False
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:= False, Transpose:=False
Next
End Sub






All times are GMT +1. The time now is 12:03 AM.

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