ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Stop Do While at Null (https://www.excelbanter.com/excel-programming/356967-stop-do-while-null.html)

Dave

Stop Do While at Null
 
What is the function to end a Do While statemnet when encountering a null,
blank or empty cell?

Thank you
Dave



Chip Pearson

Stop Do While at Null
 
Dave,

Try

If IsEmpty(ActiveCell) Then
Exit Do
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Dave" wrote in message
...
What is the function to end a Do While statemnet when
encountering a null,
blank or empty cell?

Thank you
Dave





Zack Barresse[_3_]

Stop Do While at Null
 
Hi Dave,

Something like this...

Do Until rngYourCell.Value = ""
'loop activity here
Loop

--
Regards,
Zack Barresse, aka firefytr
To email, remove NOSPAM



"Dave" wrote in message
...
What is the function to end a Do While statemnet when encountering a null,
blank or empty cell?

Thank you
Dave





Tom Ogilvy

Stop Do While at Null
 
i = 1
do while not isempty(cells(i,1))
cells(i,1).interior.colorIndex = 3
i = i + 1
Loop


i = 1
Do
cells(i,1).Interior.ColorIndex = 3
i = i + 1
Loop until isempty(cells(i,1)

--
Regards,
Tom Ogilvy

"Dave" wrote:

What is the function to end a Do While statemnet when encountering a null,
blank or empty cell?

Thank you
Dave



Dave

Stop Do While at Null
 
Should this do it? "Loop Until IsEmpty(ActiveCell.Cells)"


"Tom Ogilvy" wrote:

i = 1
do while not isempty(cells(i,1))
cells(i,1).interior.colorIndex = 3
i = i + 1
Loop


i = 1
Do
cells(i,1).Interior.ColorIndex = 3
i = i + 1
Loop until isempty(cells(i,1)

--
Regards,
Tom Ogilvy

"Dave" wrote:

What is the function to end a Do While statemnet when encountering a null,
blank or empty cell?

Thank you
Dave



Zack Barresse[_3_]

Stop Do While at Null
 
Take out the ".Cells" portion and it should work.

--
Regards,
Zack Barresse, aka firefytr
To email, remove NOSPAM



"Dave" wrote in message
...
Should this do it? "Loop Until IsEmpty(ActiveCell.Cells)"


"Tom Ogilvy" wrote:

i = 1
do while not isempty(cells(i,1))
cells(i,1).interior.colorIndex = 3
i = i + 1
Loop


i = 1
Do
cells(i,1).Interior.ColorIndex = 3
i = i + 1
Loop until isempty(cells(i,1)

--
Regards,
Tom Ogilvy

"Dave" wrote:

What is the function to end a Do While statemnet when encountering a
null,
blank or empty cell?

Thank you
Dave





Tom Ogilvy

Stop Do While at Null
 
You can use that, but in this case it superfluous. Better to do as Zack
advises

as demonstrated from the immediate window:
? isempty(activecell.Cells)
True
? isempty(activecell)
True

Eventually you will mature in your coding want to stop selecting cells,
which slows your code way down and makes the screen flash. When you do, use
the methods I originally suggested.

--
Regards,
Tom Ogilvy


"Dave" wrote in message
...
Should this do it? "Loop Until IsEmpty(ActiveCell.Cells)"


"Tom Ogilvy" wrote:

i = 1
do while not isempty(cells(i,1))
cells(i,1).interior.colorIndex = 3
i = i + 1
Loop


i = 1
Do
cells(i,1).Interior.ColorIndex = 3
i = i + 1
Loop until isempty(cells(i,1)

--
Regards,
Tom Ogilvy

"Dave" wrote:

What is the function to end a Do While statemnet when encountering a

null,
blank or empty cell?

Thank you
Dave






All times are GMT +1. The time now is 12:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com