Looping through a Range in Excel

S

smartnhandsome

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=Worksheet("sheet").range(namedrange).value
& worksheet("sheet").cell(row,col).value
end the loop
 
J

Jason Lepack

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top