ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple do until question (https://www.excelbanter.com/excel-programming/367536-simple-do-until-question.html)

T.c.Goosen1977[_57_]

Simple do until question
 

Do Until sheet1.range("a1").value = ""

The above code stops when there is nothing in a cell,

how does the code need to look when it needs to stop at the first cell
that it picks up text.

Thanks
Theuns


--
T.c.Goosen1977
------------------------------------------------------------------------
T.c.Goosen1977's Profile: http://www.excelforum.com/member.php...o&userid=35895
View this thread: http://www.excelforum.com/showthread...hreadid=562421


Don Guillett

Simple do until question
 
why not try a more modern version

For i = 1 To Cells(2, "b").End(xlDown).Row
MsgBox Cells(i, "b").Row
Next i

--
Don Guillett
SalesAid Software

"T.c.Goosen1977"
wrote in
message news:T.c.Goosen1977.2b54vr_1153225506.983@excelfor um-nospam.com...

Do Until sheet1.range("a1").value = ""

The above code stops when there is nothing in a cell,

how does the code need to look when it needs to stop at the first cell
that it picks up text.

Thanks
Theuns


--
T.c.Goosen1977
------------------------------------------------------------------------
T.c.Goosen1977's Profile:
http://www.excelforum.com/member.php...o&userid=35895
View this thread: http://www.excelforum.com/showthread...hreadid=562421




Charlie

Simple do until question
 
It is working correctly...(as you wrote it). If cell "A1" is empty nothing
will happen. But by your comment "when it needs to stop at the first cell
that..." I presume you are trying to move through a range of cells like this
(e.g. down column "A")

Dim Cell As Range

For Each Cell In Sheet1.Range("A:A")
If Cell.Value < "" Then Exit For
Next Cell

MsgBox Cell.Value & vbCrLf & Cell.Address(False, False)

"T.c.Goosen1977" wrote:


Do Until sheet1.range("a1").value = ""

The above code stops when there is nothing in a cell,

how does the code need to look when it needs to stop at the first cell
that it picks up text.

Thanks
Theuns


--
T.c.Goosen1977
------------------------------------------------------------------------
T.c.Goosen1977's Profile: http://www.excelforum.com/member.php...o&userid=35895
View this thread: http://www.excelforum.com/showthread...hreadid=562421




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

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