ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Do Until (https://www.excelbanter.com/excel-programming/332238-do-until.html)

Roger[_20_]

Do Until
 
I used "Do Until activecell = 0" in my prior Excel program but it doesn't
work in Excel 2002. Any suggestions? I would like a solution that solves
for blank rather than zero.

Thanks,

Roger



Norman Jones

Do Until
 
Hi Roger,

You could use the IsEmpty function to test for blanks, e.g.:

Sub Tester()
Dim rng As Range
Dim i As Long

Set rng = Range("A1:A10")

Do Until IsEmpty(rng(i + 1))
'Do something
i = i + 1
Loop
End Sub


---
Regards,
Norman



"Roger" wrote in message
...
I used "Do Until activecell = 0" in my prior Excel program but it doesn't
work in Excel 2002. Any suggestions? I would like a solution that solves
for blank rather than zero.

Thanks,

Roger




Harald Staff

Do Until
 
Hi Roger

It's an awful programming style, pardon my french, but it works in Excel
2002 also:

Sub test()
ActiveCell = 900
Do Until ActiveCell = 0
ActiveCell = ActiveCell - 1
Loop
End Sub

So your problem is elsewhere.

HTH. Best wishes Harald

"Roger" skrev i melding
...
I used "Do Until activecell = 0" in my prior Excel program but it doesn't
work in Excel 2002. Any suggestions? I would like a solution that solves
for blank rather than zero.

Thanks,

Roger





Leith Ross[_49_]

Do Until
 

Hello Roger,

Change your code to this...


Code:
--------------------
Do While Not IsEmpty(ActiveCell)

Roger[_20_]

Do Until
 
Thanks so much to the 3 of you for your suggestions. I chose Leith's
because of its simplicity.

Roger

"Roger" wrote in message
...
I used "Do Until activecell = 0" in my prior Excel program but it doesn't
work in Excel 2002. Any suggestions? I would like a solution that solves
for blank rather than zero.

Thanks,

Roger





All times are GMT +1. The time now is 02:18 AM.

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