mralbatross
New Member
- Joined
- Apr 25, 2023
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Hi,
Would anyone be able to tell me why this code doesn’t loop to the next worksheet and only performs the task on the active sheet?
I realize my code is poor but this is just a tester for a few additional tasks to be performed within the loop – but at this stage I can’t even get the loop to work!
As always thanks for all the support!
Sub Formatting()
Dim ws As Worksheet
If ws.Visible Then ws.Select (False)
Next
Cells.Select
Range("I30").Activate
With Selection.Font
.Name = "Verdana"
.Size = 10
.Strikethrough = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
With Selection.Font
.Name = "Verdana"
.Size = 10
.Strikethrough = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
ActiveWindow.Zoom = 83
Range("K30").Select
With Application.FindFormat.Interior
.PatternColorIndex = xlAutomatic
.Color = 8476672
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Application.ReplaceFormat.Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Cells.Replace What:="", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=True, ReplaceFormat:=True, _
FormulaVersion:=xlReplaceFormula2
End Sub
Thanks!
Would anyone be able to tell me why this code doesn’t loop to the next worksheet and only performs the task on the active sheet?
I realize my code is poor but this is just a tester for a few additional tasks to be performed within the loop – but at this stage I can’t even get the loop to work!
As always thanks for all the support!
Sub Formatting()
Dim ws As Worksheet
If ws.Visible Then ws.Select (False)
Next
Cells.Select
Range("I30").Activate
With Selection.Font
.Name = "Verdana"
.Size = 10
.Strikethrough = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
With Selection.Font
.Name = "Verdana"
.Size = 10
.Strikethrough = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
ActiveWindow.Zoom = 83
Range("K30").Select
With Application.FindFormat.Interior
.PatternColorIndex = xlAutomatic
.Color = 8476672
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Application.ReplaceFormat.Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Cells.Replace What:="", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=True, ReplaceFormat:=True, _
FormulaVersion:=xlReplaceFormula2
End Sub
Thanks!