View Single Post
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

I like this:

Option Explicit
Sub testme()

Dim RowNumber As Long
Dim LastCellInRow As Range

RowNumber = 123

With ActiveSheet
Set LastCellInRow = .Cells(RowNumber, .Columns.Count).End(xlToLeft)
End With

If IsEmpty(LastCellInRow) Then
'do nothing (we're in column A)
Else
Set LastCellInRow = LastCellInRow.Offset(0, 1)
End If

LastCellInRow.Value = "hi there"

End Sub


Mark wrote:

I want to write a macro that enters data into the cell following the last
cell in a row, so I need to automatically jump to the last cell, plus one.

How to jump to the last cell in a row?


--

Dave Peterson