I am trying to loop the code below through all worksheets within a workbook, but so far have been unsuccesful. The code between the 'for each' and 'next' statement is only a small part of my actual code, but I am not understanding why it is only running the code for the active worksheet, not all worksheets. What am I missing?
Sub AllSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
Range("C3:I3").Select
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
GoToNextSheet:
Next ws
End Sub
Sub AllSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
Range("C3:I3").Select
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
GoToNextSheet:
Next ws
End Sub