View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Kilmer[_2_] Bob Kilmer[_2_] is offline
external usenet poster
 
Posts: 71
Default find last column

Sub FindLastEmptyCellInRow1()
Dim rng As Range
'find the last cell in row 1 with something in it.
Set rng = Rows(1).Cells.Find("*", , , xlPart, xlByColumns, xlPrevious,
False)
If rng Is Nothing Then
'no occupied cells
MsgBox "Column: #1"
Else
If rng.Column = Columns.count Then
MsgBox "Last cell is full"
Else
MsgBox "Column: #" & rng.Column + 1
End If
End If
Set rng = Nothing
End Sub

wrote in message
...
how can i find the last column in a particular row.
To fidn the last column in a the sheet we find thru:
With ActiveSheet.UsedRange
lastColSum = .Column + .Columns.Count - 1
End With
but what if i want to find in a particular row?

thanks in advance