Addressing cells on inactive sheets

J

John Duffus

Hi,

I 'm still using Excel 97 and have this sub in a module.

Public Sub CellsOnInactiveSheet()
With Sheets("Sheet1")
.Range(.Range("A1"), .Range("B2")).Select
End With
End Sub

If any sheet except Sheet1 is active this produces an error.
I would have thought with a fully qualified address it should work with any
sheet active.

I don't really want to activate the sheet if I can help it.
Any help appreciated, thanks,
John Duffus
 
J

Jim May

Perhaps the .Select property cannot cross-over sheets;
it is restricted to only the sheet where code is running.
 
J

John Duffus

Thanks Jim,
I can use the same addressing to read the range into an
array, regardless of which sheet is active, so it is my use of the Select
property that seems to be the problem.
John Duffus
 
Top