Adding a Confirmation Step to Macro

  • Thread starter Thread starter saturnin02
  • Start date Start date
S

saturnin02

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
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top