ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Looping through a Range in Excel (https://www.excelbanter.com/excel-programming/409214-looping-through-range-excel.html)

smartnhandsome

Looping through a Range in Excel
 
Can any one suggest a way to loop through an Excel worksheet rows till
i see a null in the contents of the cell Here is sort of pseudo code.

Start
Worksheet("sheet").cell(row,col) < ""
Worksheet("sheet").range(namedrange).value=Workshe et("sheet").range(namedrange).value
& worksheet("sheet").cell(row,col).value
end the loop

Jason Lepack

Looping through a Range in Excel
 
public sub test()
dim r as range
set r = activeworksheet.range("A1")
do while not r =""
debug.print r.address
set r = r.offset(1,0)
loop
set r = nothing
end sub

Cheers,
Jason Lepack

On Apr 11, 12:45 pm, smartnhandsome wrote:
Can any one suggest a way to loop through an Excel worksheet rows till
i see a null in the contents of the cell Here is sort of pseudo code.

Start
Worksheet("sheet").cell(row,col) < ""
Worksheet("sheet").range(namedrange).value=Workshe et("sheet").range(namedrange).value
& worksheet("sheet").cell(row,col).value
end the loop



smartnhandsome

Looping through a Range in Excel
 
thanks for your help Jason Lepack


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

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