ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determining the Selection on a non-active Sheet? (https://www.excelbanter.com/excel-programming/295379-determining-selection-non-active-sheet.html)

Jim S.[_4_]

Determining the Selection on a non-active Sheet?
 
Hi,

Is there a way to determine the range of cells that have
been selected on "another" sheet, without first activating
it? I want to be able to say something like:

Dim theSel as Range
Set theSel = Worksheets("A nonactive sheet").Selection

but this obviously fails. Any way to accomplish the
equivalent without activating or selecting that other
sheet?

Thanks,
Jim S.


Frank Kabel

Determining the Selection on a non-active Sheet?
 
Hi Jim
AFAIK you have to activate/select the sheet first. You may hide this
with diaabling the screenupdating

--
Regards
Frank Kabel
Frankfurt, Germany


Jim S. wrote:
Hi,

Is there a way to determine the range of cells that have
been selected on "another" sheet, without first activating
it? I want to be able to say something like:

Dim theSel as Range
Set theSel = Worksheets("A nonactive sheet").Selection

but this obviously fails. Any way to accomplish the
equivalent without activating or selecting that other
sheet?

Thanks,
Jim S.



Dave Peterson[_3_]

Determining the Selection on a non-active Sheet?
 
If you look at VBA's help for Selection, you'll see that it applies to the
application or window object.

You'll have to go through one of them to get it.

MsgBox Windows(1).Selection.Address & "--" & Windows(1).Caption
MsgBox Windows(2).Selection.Address & "--" & Windows(2).Caption

"Jim S." wrote:

Hi,

Is there a way to determine the range of cells that have
been selected on "another" sheet, without first activating
it? I want to be able to say something like:

Dim theSel as Range
Set theSel = Worksheets("A nonactive sheet").Selection

but this obviously fails. Any way to accomplish the
equivalent without activating or selecting that other
sheet?

Thanks,
Jim S.


--

Dave Peterson



All times are GMT +1. The time now is 05:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com