PDA

View Full Version : Macro Edit



jleve1974
02-10-2008, 08:26 AM
The code below basically highlights all tabs labeled Pg1 - Pg15, Copys All, then Paste Specials back just the "values", then deletes the tab labeled BUTTONS and finally re-highlights all remaining tabs (Pg1-Pg15).
The problem I'd like resolved is that everytime I run this macro, I get prompted with a message basically saying, are you sure you want to delete the "BUTTONS" tab? I have to consistently keep pressing "Yes" to complete the process.

Can anyone edit this macro to run without prompting me with that question?

Sub Macro1()
' Macro1 Macro
' Macro recorded 2/10/2008 by Johnny
Sheets(Array("Pg1", "Pg2", "Pg3", "Pg4", "Pg5", "Pg6", "Pg7", "Pg8", "Pg9", "Pg10", _
"Pg11", "Pg12", "Pg13", "Pg14", "Pg15")).Select
Sheets("Pg1").Activate
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("BUTTONS").Select
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.Delete
Sheets(Array("Pg1", "Pg2", "Pg3", "Pg4", "Pg5", "Pg6", "Pg7", "Pg8", "Pg9", "Pg10", _
"Pg11", "Pg12", "Pg13", "Pg14", "Pg15")).Select
Sheets("Pg1").Activate
End Sub

Bob Phillips
02-10-2008, 08:57 AM
Sub Macro()
' Macro1 Macro
' Macro recorded 2/10/2008 by Johnny
Sheets(Array("Pg1", "Pg2", "Pg3", "Pg4", "Pg5", "Pg6", _
"Pg7", "Pg8", "Pg9", "Pg10", "Pg11", "Pg12", _
"Pg13", "Pg14", "Pg15")).Select
With Worksheets("Pg1")
.Cells.Copy
.Cells.PasteSpecial Paste:=xlPasteValues
End With
Application.DisplayAlerts = False
Sheets("BUTTONS").Delete
Application.DisplayAlerts = True
Sheets("Pg1").Activate
End Sub

jleve1974
02-10-2008, 09:00 AM
I love this site! Thanks XLD, your code worked perfectly.