Sub t()
' how can I find sheets(i).selection.addres
s WITHOUT using Activate method?
' Currently, I Activate the sheet, get the selection.address, then Activate my original sheet.
' It is a minor problem, but I find it annoying.
' Here are examples that demonstrate several attempts that don't work
' example #1 works, but it uses the Activate method
For i = 1 To Sheets.count
Sheets(i).Activate
Debug.Print Selection.Address
Next i
' example #2 doesn't abort, but it doesn't work. For obvious reasons, it always reports the active sheet's address.
For i = 1 To Sheets.count
Debug.Print Sheets(i).Application.Sele
ction.Addr
ess
Next i
' example #3 gives "object doesn't support this property or method". This is because Selection is a property of the application, NOT the workbook or the worksheet.
For i = 1 To Sheets.count
Debug.Print Sheets(i).Selection.Addres
s
Next i
End Sub
Start Free Trial