View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Finding Next Empty Cell in a Range

hi
this code is ugly but it works. think i've been up too long.
i assumed that you have a header row in row 1 and data entry starts in row 2.
i assumed that you input start at A2 across to AE2 then down to A3.
if my assumption are not correct then code may be useless.
code goes in a standard module.
Alt+F11.
in the project window(far left), expand the project(file)
if no module then on the vb menu barinsertmodule
paste the code in the code window(far right)
keyboard short cut.
on the menu bartoolsmacromacro
highlight the macro
click the options button.
enter shortcut. ok out.
Sub FindNextEmptyCell()
Dim r, ro As Range
Dim c As Long
c = 1
Set r = Range("A2")
Do While Not IsEmpty(r)
Set ro = r.Offset(0, 1)
If c 30 Then
Set r = r.Offset(1, -30)
Set ro = r.Offset(0, 1)
c = 1
End If
If Not IsEmpty(r) Then
Set r = ro
c = c + 1
End If
Loop
r.Select
End Sub

regards
FSt1

"Stilltrader47" wrote:

My worksheet is set-up for 12 month price tracking. The entry range is 12
rows (months) by 31 columns (days). How can I write a macro that will locate
the cursor to the next empty cell in the range? What I am looking for is an
efficient "find" command. I would prefer to execute by ctl-(letter) if
possible.

Thanks for helping.