View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rick is offline
external usenet poster
 
Posts: 334
Default How to find next empty cell within a column?

Thanks Dave, it works great, now for another issue. Macro Build did the
following:________________________________________ ____________________
Sheets("Bald").Select
Range("A5:K12").Select
Selection.Sort Key1:=Range("A5"), Order1:=xlAscending, Key2:=Range("B5") _
, Order2:=xlAscending, Key3:=Range("C5"), Order3:=xlAscending, Header:=_
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom--
__________________________________________________ __________________
I now want to create sub procedure to do Sorts, but I have a problem that I
cannot get around, its the Range.Select statement. I have different length
sheets that I was to sort some are Range("B4:L24"), or Range("B5:L57")... Is
there a way to test the cell range ie ="B4:L24" or = "B5:L57" ?????


Rick Rack


"Dave Peterson" wrote:

If you have a formula in the cell, then the cell is not empty.

If you're looking for the next cell that looks empty, maybe just looking down
that column...

Option Explicit
Sub testme()

Dim myCell As Range
Dim NextEmpty As Range

Set myCell = ActiveSheet.Range("a1")
Do
If myCell.Value = "" Then
Set NextEmpty = myCell
Exit Do
Else
Set myCell = myCell.Offset(1, 0)
End If
Loop

MsgBox NextEmpty.Address

End Sub

If the starting cell looks blank, then that'll be the nextcell. If you want it
to always be under the starting cell, change this line:

Set myCell = ActiveSheet.Range("a1")
to
Set myCell = ActiveSheet.Range("a1").offset(1,0)



Rick wrote:

I need a formula that will find the next empty cell within a column. There is
a formula in that cell but no data. The formula is the same through out the
column. What do you suggest?
--
Rick Rack


--

Dave Peterson