Is it necessary to activate a sheet when one wants to freeze or unfreeze panes in vba? Can't this be avoided?
I want to visualize all sheets and freeze them on B5.
I want to visualize all sheets and freeze them on B5.
VBA Code:
Private Sub ShowSheets()
For Each ws In ThisWorkbook.Worksheets
With ws
.Visible = True
.Activate
End With
Range("B5").Select
ActiveWindow.FreezePanes = True
Next ws
End Sub