Enter an IF statement in a recorded macro

Copper Contributor

I have the following macro that I recorded that I would like to start with an IF statement. At the beginning, if the "Home" sheet is deleted, it will run the rest of the macro. Any help would be appreciated.

 

Sub Macro2()
'
' Macro2 Macro
'

'
Sheets("Home").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Work Center Template").Select
ActiveSheet.Unprotect
ActiveSheet.Shapes.Range(Array("Group 6")).Select
Selection.Cut
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("SAC Template").Select
ActiveSheet.Unprotect
ActiveSheet.Shapes.Range(Array("Group 9")).Select
Selection.Cut
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowInsertingRows:=True, AllowInsertingHyperlinks:=True, _
AllowDeletingRows:=True
Sheets("Work Center Template (1)").Select
ActiveSheet.Unprotect
ActiveSheet.Shapes.Range(Array("Group 6")).Select
Selection.Cut
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Work Center Template (2)").Select
ActiveSheet.Unprotect
ActiveSheet.Shapes.Range(Array("Group 6")).Select
Selection.Cut
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Work Center Template (3)").Select
ActiveSheet.Unprotect
ActiveSheet.Shapes.Range(Array("Group 6")).Select
Selection.Cut
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Work Center Template (4)").Select
ActiveSheet.Unprotect
ActiveSheet.Shapes.Range(Array("Group 6")).Select
Selection.Cut
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Work Center Template (5)").Select
ActiveSheet.Unprotect
ActiveSheet.Shapes.Range(Array("Group 6")).Select
Selection.Cut
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Work Center Template (6)").Select
ActiveSheet.Unprotect
ActiveSheet.Shapes.Range(Array("Group 6")).Select
Selection.Cut
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Work Center Template (7)").Select
ActiveSheet.Unprotect
ActiveSheet.Shapes.Range(Array("Group 6")).Select
Selection.Cut
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Work Center Template (8)").Select
ActiveSheet.Unprotect
ActiveSheet.Shapes.Range(Array("Group 6")).Select
Selection.Cut
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Work Center Template (9)").Select
ActiveSheet.Unprotect
ActiveSheet.Shapes.Range(Array("Group 6")).Select
Selection.Cut
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Work Center Template (10)").Select
ActiveSheet.Unprotect
ActiveSheet.Shapes.Range(Array("Group 6")).Select
Selection.Cut
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Work Center Template (11)").Select
ActiveSheet.Unprotect
ActiveSheet.Shapes.Range(Array("Group 6")).Select
Selection.Cut
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("All Programs").Select
ActiveSheet.Unprotect
ActiveSheet.Shapes.Range(Array("Group 6")).Select
Selection.Cut
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Unit Training Manager").Select
ActiveSheet.Unprotect
ActiveSheet.Shapes.Range(Array("Group 6")).Select
Selection.Cut
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowInsertingRows:=True, AllowInsertingHyperlinks:=True, _
AllowDeletingRows:=True
End Sub

2 Replies
They weren't submitting, the 3rd one did. The first 2 must have gotten stuck somewhere.