View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rowan Drummond[_3_] Rowan Drummond[_3_] is offline
external usenet poster
 
Posts: 414
Default first empty cell

Try:

Sub EmptyCell()
Dim eCell As Range
If IsEmpty(Range("A4")) Then
Set eCell = Range("A4")
Else
Set eCell = Range("A3").End(xlDown).Offset(1, 0)
End If
MsgBox eCell.Address
End Sub

Hope this helps
Rowan

TheIrishThug wrote:
starting at A3 i need to return the first cell that is empty.

i tried:
Row = 3
While IsEmpty("A" & Row) = False
Row = Row + 1
Wend

but i get a overflow error that selects "row=row+1"

i found the following code somewhere else, but this won't work. the
sheet i'm using is setup as a list. so the last line of the list says
"total." since the following looks from the bottom up, it does not go
to possible empty cells above that.

code:
Sub FindLastCell()
Dim LastCell As Range
With ActiveSheet
Set LastCell = .Cells(.Rows.Count, "A").End(xlUp)
If IsEmpty(LastCell) Then
'do nothing
Else
Set LastCell = LastCell.Offset(1, 0)
End If
End With
MsgBox LastCell.Row
End Sub