Thread: simple question
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default simple question

On Thu, 16 Sep 2004 17:23:05 -0700, "bob"
wrote:

The formula =ROW(G11) returns the value 11

I need VBA Code that will return the row value of the
active cell. For example, I want the value of Sheet1:A1
to be the current active cell value (i.e if the current
active cell is G11 the value returned for Sheet1:A1 would
be 11).


Right click on the sheet tab and select View Code.

Paste the following code into the window that opens:

=================
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
[a1].Value = activecell.Row
End Sub
=====================

This will work on the worksheet that you selected.


--ron