Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
If activecell.column = variable then activecell,offset (0,1) | Excel Discussion (Misc queries) | |||
ActiveCell.FormulaR1C1 Sum Function | Excel Programming | |||
Name the ActiveCell | Excel Programming | |||
activecell | Excel Programming | |||
How to avoid error 2015 when using ActiveCell.Offsett in own function | Excel Programming |