tracking the active cell row number

  • Thread starter Thread starter arron
  • Start date Start date
A

arron

I posted this earlier and got a way of doing it by using CELL("row") an
pressing F9 each time I change row, but that seems a bit cumbersome.

What I would like is someway of either a formula or macro running i
the background (maybe on each up or down arrow or enter key stroke
constantly checking the active cell and displaying its row number i
another cell.

I am trying to create a data entry table and the colum headers chang
on the result of the first entry in each row.

I can get this to work by adding an 'add data line' button which check
the content of the first colum and edits the heading accordingly. So
I can add rows with the correct heading present but if I later decid
to go back and edit the data, the headings represent the last entry
not the current row and I can't figure a way of getting the correc
headings without adding another 'edit data' button that would agai
check the first colum of the current row.

Any thoughts?

Cheers

Arro
 
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Whatrow As Integer
Whatrow = ActiveCell.Row
Range("A1").Value = Whatrow
End Sub

Seems to work..
 
That's great!

But I don't know the difference between private and public Subs.

If I paste it in as you wrote it, I can't see the macro. I have to
remove the text in the brackets.

What am I doing wrong?

Cheers

Arron
 
I'm guessing that Arron actually put the code into a general module.

The code that JMay provided actually goes in the worksheet module behind the
sheet that should have this behavior.

Just rightclick on that worksheet tab and select view code and paste the
original code in--put back the stuff you took out.
 
Back
Top