Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Search for first empty cell.

In Vb, I am trying to set as the ActiveCell, the first empty multiple of ~ 30
in column A.
I.E. If A1 = "one"
A31 = "Example"

the program will spot this and set as ActiveCell A61.

PS Although setting this as active cell may not be the best way to do what
I am trying to do, I quite enjoy finding out for myself how to do things and
so I am not too worried how messy my code is. This has got me stumped though,
I can't even think of a long winded way to do it. Not when I could
potentially use all 65k rows.

I'd very much appreciate all assistance.

--
Dave
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Search for first empty cell.

Hi Davey,

Try:
'=============
Public Sub TesterA()
Dim rngEmpty As Range
Dim i As Long

For i = 1 To Rows.Count Step 3
Set rngEmpty = Cells(i, "A")
If IsEmpty(rngEmpty) Then
Exit For
End If
Next i

If Not rngEmpty Is Nothing Then
MsgBox rngEmpty.Address
End If
End Sub
'<<=============


---
Regards,
Norman



"DaveyJones" wrote in message
...
In Vb, I am trying to set as the ActiveCell, the first empty multiple of ~
30
in column A.
I.E. If A1 = "one"
A31 = "Example"

the program will spot this and set as ActiveCell A61.

PS Although setting this as active cell may not be the best way to do
what
I am trying to do, I quite enjoy finding out for myself how to do things
and
so I am not too worried how messy my code is. This has got me stumped
though,
I can't even think of a long winded way to do it. Not when I could
potentially use all 65k rows.

I'd very much appreciate all assistance.

--
Dave



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Search for first empty cell.

Sub FindEmptyCell()
For i = 1 To 65536 Step 30
Debug.Print i
If IsEmpty(Cells(i, 1)) Then
Cells(i, 1).Select
Exit Sub
End If
Next
End Sub

--
Regards,
Tom Ogilvy



"DaveyJones" wrote:

In Vb, I am trying to set as the ActiveCell, the first empty multiple of ~ 30
in column A.
I.E. If A1 = "one"
A31 = "Example"

the program will spot this and set as ActiveCell A61.

PS Although setting this as active cell may not be the best way to do what
I am trying to do, I quite enjoy finding out for myself how to do things and
so I am not too worried how messy my code is. This has got me stumped though,
I can't even think of a long winded way to do it. Not when I could
potentially use all 65k rows.

I'd very much appreciate all assistance.

--
Dave

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Search for first empty cell.

Hi Davey,

Please replace my code with the following version:

'=============
Public Sub TesterA()
Dim rngEmpty As Range
Dim i As Long

For i = 1 To Rows.Count Step 3
If IsEmpty(Cells(i, "A")) Then
Set rngEmpty = Cells(i, "A")
Exit For
End If
Next i

If Not rngEmpty Is Nothing Then
MsgBox rngEmpty.Address
End If
End Sub
'<<=============


---
Regards,
Norman


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Search for first empty cell.

Thanks alot you guys, I've got it sorted now, i'm on version 6 of my program
though. V5 worked, but I didn't structure it so i don't even know whats going
on and I wrote it ...

--
Dave


"Tom Ogilvy" wrote:

Sub FindEmptyCell()
For i = 1 To 65536 Step 30
Debug.Print i
If IsEmpty(Cells(i, 1)) Then
Cells(i, 1).Select
Exit Sub
End If
Next
End Sub

--
Regards,
Tom Ogilvy



"DaveyJones" wrote:

In Vb, I am trying to set as the ActiveCell, the first empty multiple of ~ 30
in column A.
I.E. If A1 = "one"
A31 = "Example"

the program will spot this and set as ActiveCell A61.

PS Although setting this as active cell may not be the best way to do what
I am trying to do, I quite enjoy finding out for myself how to do things and
so I am not too worried how messy my code is. This has got me stumped though,
I can't even think of a long winded way to do it. Not when I could
potentially use all 65k rows.

I'd very much appreciate all assistance.

--
Dave

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SUMPRODUCT + ISNUMBER(SEARCH) + Empty Cells BLUV Excel Discussion (Misc queries) 4 January 30th 09 05:47 AM
Leaving an empty cell empty GRL Excel Discussion (Misc queries) 4 April 22nd 06 05:47 PM
why a reference to an empty cell is not considered empty Nicoscot Excel Discussion (Misc queries) 10 March 10th 06 05:36 AM
Finding next empty empty cell in a range of columns UncleBun Excel Programming 1 January 13th 06 11:22 PM
Empty cell and a the empty String JE McGimpsey Excel Programming 0 September 13th 04 04:12 PM


All times are GMT +1. The time now is 02:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"