Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using the ActiveCell function on 2 different worksheets


I have 2 worksheets in a workbook, and I need to be able to select
cell or row from each worksheet and be able to find out which ro
number each of them are in.
I know that to get one you use ActiveCell.Row, but is there any way t
do this specifying the sheet it is comming from, so I can do it for
different sheets in the same macro?
Thanks
Catherin

--
Catherine
-----------------------------------------------------------------------
CatherineN's Profile: http://www.excelforum.com/member.php...fo&userid=3546
View this thread: http://www.excelforum.com/showthread.php?threadid=55247

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Using the ActiveCell function on 2 different worksheets

I think you're going to have to activate each of the worksheets.

Option Explicit

Sub testme()

Dim wks1 As Worksheet
Dim wks2 As Worksheet

Dim Row1 As Long
Dim Row2 As Long

Set wks1 = Worksheets("Sheet1")
Set wks2 = Worksheets("Sheet2")

With wks1
.Select
Row1 = ActiveCell.Row
End With

With wks2
.Select
Row2 = ActiveCell.Row
End With

MsgBox Row1 & vbLf & Row2

End Sub

CatherineN wrote:

I have 2 worksheets in a workbook, and I need to be able to select a
cell or row from each worksheet and be able to find out which row
number each of them are in.
I know that to get one you use ActiveCell.Row, but is there any way to
do this specifying the sheet it is comming from, so I can do it for 2
different sheets in the same macro?
Thanks
Catherine

--
CatherineN
------------------------------------------------------------------------
CatherineN's Profile: http://www.excelforum.com/member.php...o&userid=35469
View this thread: http://www.excelforum.com/showthread...hreadid=552479


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using the ActiveCell function on 2 different worksheets


no luck and if i had ANY idea what i was doing, maybe
could attempt to make a minor change to make it work... it says it i
out of range but I dont have any idea what that means. Thanks for th
help thoug

--
Catherine
-----------------------------------------------------------------------
CatherineN's Profile: http://www.excelforum.com/member.php...fo&userid=3546
View this thread: http://www.excelforum.com/showthread.php?threadid=55247

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Using the ActiveCell function on 2 different worksheets

I'm betting that you got an error on one of these two lines:

Set wks1 = Worksheets("Sheet1")
Set wks2 = Worksheets("Sheet2")

In my test workbook, my worksheets were named Sheet1 and sheet2.

What are your sheet names?

Put those names in that code.


CatherineN wrote:

no luck and if i had ANY idea what i was doing, maybe I
could attempt to make a minor change to make it work... it says it is
out of range but I dont have any idea what that means. Thanks for the
help though

--
CatherineN
------------------------------------------------------------------------
CatherineN's Profile: http://www.excelforum.com/member.php...o&userid=35469
View this thread: http://www.excelforum.com/showthread...hreadid=552479


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using the ActiveCell function on 2 different worksheets


Thank you I got it working :)


--
CatherineN
------------------------------------------------------------------------
CatherineN's Profile: http://www.excelforum.com/member.php...o&userid=35469
View this thread: http://www.excelforum.com/showthread...hreadid=552479

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
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
ActiveCell.FormulaR1C1 Sum Function mb Excel Programming 7 October 29th 05 11:40 PM
Name the ActiveCell Vikxcel Excel Programming 1 October 19th 05 01:37 AM
activecell slikity Excel Programming 7 December 13th 04 11:59 AM
How to avoid error 2015 when using ActiveCell.Offsett in own function Torben Laursen Excel Programming 2 February 18th 04 03:53 PM


All times are GMT +1. The time now is 12:03 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"