View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default getting the selected range and active cell of a non active wor

Hi,

I'm struggling to understand what value it brings knowing this about an
inactive sheet. If you want a value from a sheet you can get it without any
sheet\range selection and the same goes for writing a value.

Mike

"GerryGerry" wrote:

Hi,

Thank you for this. You have understood exactly what I wanted although I did
use the wrong terminology. I was wondering whether this was achievable
without activating the sheet (even with screenupdating turned off). It seems
a little surprising to me that this info is not accessible directly somehow
through excels object model.

It's not just that the code is cumbersome, it's the fact that I can't loose
the focus of the current cell while obtaining values from the other
worksheets in my intended application.

Thanks to all
Gerry

"Mike H" wrote in message
...
Hi,

If a sheet is not active, no cells have focus, none are active, none are
selected. You cannot use those properties on an inactive sheet.

If you want the address of the cell that would be active if the sheet was
selected then you can do this

Application.ScreenUpdating = False
Sheets("Sheet2").Select
Where = Selection.Address
Sheets("Sheet1").Select
MsgBox "The selected cell on Sheet2 is " & Where
Application.ScreenUpdating = True

With screenupdating being false you will not see sheet 2 being fleetingly
activated.

Mike

"GerryGerry" wrote:

Can one access the active cell of a non active sheet (without activating
it
first) in VBA as well as the selected range?

any help much appreciated as always
(i'm using Excel 2003)