View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default last non-empthy cell

One way is to look at the top cell. then the second, then slide down to the
bottom if both are non-empty:

Option Explicit
Sub testme()

Dim DestCell As Range
Dim iCol As Long

iCol = 6

With Worksheets("sheet1")
If IsEmpty(.Cells(1, iCol)) Then
Set DestCell = .Cells(1, iCol)
ElseIf IsEmpty(.Cells(2, iCol)) Then
Set DestCell = .Cells(2, iCol)
Else
Set DestCell = .Cells(1, iCol).End(xlDown).Offset(1, 0)
End If
End With

DestCell.Select

End Sub

I used iCol = 6 (column F) in my example.

dov wrote:

hi, i need to "tell" the macro to move the coursor to the first empthy cell
in a coloumn, how to do that?

thanks, dov


--

Dave Peterson