Active Cells

S

Steve

I note from a previous post that an active cell's reference can be displayed
by inserting some code, as follows:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A1").Value = Cells(Target.Row, Target.Column).Address(False, False)
End Sub

If I wish to show only the Active Cell's line number, how should this code
be changed? Does inserting code like this mess up the Undo function?
 
B

Bob Umlas

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A1").Value = Target.Row
End Sub
 
M

Mike H

Steve,

If by line you mean row then try this

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A1").Value = Target.Row
End Sub
Does inserting code like this mess up the Undo function?

Yes

Mike
 
S

Steve

Many thanks..problem sorted!

Mike H said:
Steve,

If by line you mean row then try this

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A1").Value = Target.Row
End Sub


Yes

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top