Get value at end of a row

N

NDBC

I am trying to pull the last value in a row and am using the code

lastlap = Sheets("B Grade").Range("H" & riderCell.Row).End(xlRight)

I am determining the starting position of the row with the constant
ridercell. (eg the value I need is to the right of h2 or h100 depending on
the value of ridercell). The worksheet "b grade" is not always the active
sheet if this makes a difference to the code.

Thanks
 
G

Gary Keramidas

not sure exactly what you want.

Sub test()
Dim ridercell As Range
Dim lastcol As Long
Dim lastlap As String
With Sheets("b grade")
Set ridercell = .Range("A26")
lastcol = .Cells(ridercell.Row,
Columns.Count).End(xlToLeft).Column
lastlap = .Cells(ridercell.Row, lastcol).Address
MsgBox lastlap
End With
End Sub
 
J

Jacob Skaria

Try

Dim lngCol as Long
lngCol = Sheets("B Grade").Cells(Ridercell.Row,
Columns.Count).End(xlToLeft).Column
Msgbox cells(Ridercell.Row,lngCol)

If this post helps click Yes
 

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