I have a workbook with multiple sheets.
I have some simple code that I thought would work, but for some reason it doesn't.
Here is the code in a module:
I run it and it doesn't work.
However, if I add:
ws.Activate
Prior to ws.Range("A1").Select, then it works perfectly.
Why do I need to activate each worksheet prior to selecting that worksheet's A1 cell?
Thanks for the clarification!!
-Spydey
I have some simple code that I thought would work, but for some reason it doesn't.
Here is the code in a module:
Code:
Sub GoHome()
Dim wb As Workbook
Dim ws As Worksheet
Set wb = ThisWorkbook
For Each ws In wb.Worksheets
ws.Range("A1").Select
Next ws
End Sub
I run it and it doesn't work.
However, if I add:
ws.Activate
Prior to ws.Range("A1").Select, then it works perfectly.
Why do I need to activate each worksheet prior to selecting that worksheet's A1 cell?
Thanks for the clarification!!
-Spydey