Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to get the activecell of inactive worksheet ?

If the active worksheet is sheet1, is it possible to get the activecell value in sheet2 without selecting it ?

Thank you



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default How to get the activecell of inactive worksheet ?

Worksheets("Sheet2").Cells(1,1).Value

or

Worksheets("Sheet2").Range("A1").Value

The first is useful because it is easier to program the row and column
refrence in the Cell(row,col), the second is ideal if you are just picking a
specfic value only.

HTH
Cheers
Nigel

"steven" wrote in message
...
If the active worksheet is sheet1, is it possible to get the activecell

value in sheet2 without selecting it ?

Thank you





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to get the activecell of inactive worksheet ?

Thx for your reply. How about if I don't know the exact refrence in sheet2 ?
I need to get the activecell reference in sheet2 but don't want to select sheet2 first.

"Nigel" bl...
Worksheets("Sheet2").Cells(1,1).Value

or

Worksheets("Sheet2").Range("A1").Value

The first is useful because it is easier to program the row and column
refrence in the Cell(row,col), the second is ideal if you are just picking a
specfic value only.

HTH
Cheers
Nigel

"steven" wrote in message
...
If the active worksheet is sheet1, is it possible to get the activecell

value in sheet2 without selecting it ?

Thank you







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default How to get the activecell of inactive worksheet ?


AFAIK - The active cell only relates to the worksheet in the active window,
the selection relates to a specified range. So I do not see any other way
of selecting from what would be the active cell until you activate the
sheet. If you do not want the user to see the switch to sheet2 then turn
off the Application.ScreenUpdating then activate sheet2 pick up the Active
Cell value and activate sheet1. Turn Application.ScreenUpdating back on.

something like....

Application.ScreenUpdating = False
Sheets("Sheet2").Activate
N = ActiveCell
Sheets("Sheet1").Activate
Application.ScreenUpdating = True
' process using the value in N

Cheers
Nigel


"steven" wrote in message
...
Thx for your reply. How about if I don't know the exact refrence in sheet2

?
I need to get the activecell reference in sheet2 but don't want to select

sheet2 first.

"Nigel"

bl...
Worksheets("Sheet2").Cells(1,1).Value

or

Worksheets("Sheet2").Range("A1").Value

The first is useful because it is easier to program the row and column
refrence in the Cell(row,col), the second is ideal if you are just

picking a
specfic value only.

HTH
Cheers
Nigel

"steven" wrote in message
...
If the active worksheet is sheet1, is it possible to get the

activecell
value in sheet2 without selecting it ?

Thank you









  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to get the activecell of inactive worksheet ?

Steven,

Activecell applies to the active window, so there is only one. You can get
the selection from any window though. Here is a post from Dave Peterson a
couple of days ago on this topic

-----------------------------------------------------------------------

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

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"steven" wrote in message
...
If the active worksheet is sheet1, is it possible to get the activecell

value in sheet2 without selecting it ?

Thank you







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default How to get the activecell of inactive worksheet ?

I think Activecell also belongs to the window object. So if you have multiple
windows available (I usually don't!), you could get it that way:

Dim myWindow As Window
For Each myWindow In ActiveWorkbook.Windows
MsgBox myWindow.Caption & "-" & ActiveCell.Address(external:=True)
Next myWindow

But I wouldn't use this. I'd just go and look like Nigel did.



Bob Phillips wrote:

Steven,

Activecell applies to the active window, so there is only one. You can get
the selection from any window though. Here is a post from Dave Peterson a
couple of days ago on this topic

-----------------------------------------------------------------------

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

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"steven" wrote in message
...
If the active worksheet is sheet1, is it possible to get the activecell

value in sheet2 without selecting it ?

Thank you




--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
data tab inactive Karen-Ellaville New Users to Excel 1 August 16th 09 05:56 PM
How do I email an inactive copy of a worksheet Jackaroo 1281 Excel Discussion (Misc queries) 1 January 1st 09 03:36 PM
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
Inactive URL links Motlalepula Excel Discussion (Misc queries) 1 January 19th 07 08:35 PM
Inactive close Dave Hardy Excel Programming 1 August 12th 03 03:11 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"