davidlants
New Member
- Joined
- Aug 24, 2011
- Messages
- 4
Hi,
Here is my code, I just want VBA to run through all the worksheets in my workbook and complete the code in it but it won't work. The strange part is that it works fine if I take the code out of the worksheet loop and use it on one individual worksheet. Any help is greatly appreciated!!!!
Sub LoopThroughSheets()
Dim Current As Worksheet
For Each Current In Worksheets
Range("E4:AS4,E6:AS6,E8:AS8").Select
Selection.Style = "Percent"
Selection.NumberFormat = "0.0%"
Range("A1").Select
ActiveCell.FormulaR1C1 = "INDEX"
Range("A1").Select
With Selection.Font
.Name = "Calibri"
.Size = 6
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
Activesheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:="INDEX!A1", TextToDisplay:="INDEX"
Next
End Sub
Here is my code, I just want VBA to run through all the worksheets in my workbook and complete the code in it but it won't work. The strange part is that it works fine if I take the code out of the worksheet loop and use it on one individual worksheet. Any help is greatly appreciated!!!!
Sub LoopThroughSheets()
Dim Current As Worksheet
For Each Current In Worksheets
Range("E4:AS4,E6:AS6,E8:AS8").Select
Selection.Style = "Percent"
Selection.NumberFormat = "0.0%"
Range("A1").Select
ActiveCell.FormulaR1C1 = "INDEX"
Range("A1").Select
With Selection.Font
.Name = "Calibri"
.Size = 6
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
Activesheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:="INDEX!A1", TextToDisplay:="INDEX"
Next
End Sub
Last edited: