Locating Specific Row

  • Thread starter Thread starter RVS
  • Start date Start date
R

RVS

Hello All,

Is there any way that I can write some code that will locate and return the
row number where new data is being entered? The idea here is that after the
user enters in new data certain cells will be filled automatically in that
row...but, of course, the program needs to know which row to go to. I usually
include my own attempt with my question, but I don't have any clue where to
start here.

Thanks!
 
Private Sub Worksheet_Change(ByVal Target As Range)
Dim nRow As Long, nCol As Long
Dim sAddr As String
With Target(1)
nRow = .Row
nCol = .Column
sAddr = .Address
End With
nRow = Target(1).Row
MsgBox "row: " & nRow & vbCr & _
"col: " & nCol & vbCr & _
sAddr
End Sub

This Worksheet event code goes in the sheet module, rt=click sheet tab and
view code

Regards,
Peter T
 
Target.Row in Worksheet Change event..

Private Sub Worksheet_Change(ByVal Target As Range)
Dim lngRow as Long, lngCol as Column
lngRow = Target.Row
lngCol = Target.Column

End Sub

If this post helps click Yes
 
Back
Top