View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
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