Need loop help.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

ok, I have code that will copy a sheet from on workbook to another. Now I
need to repeat that process over and over.

I need to look at c6 through c-29. When the cell it looks at isn't blank, I
need it to run my code. When it is blank (end of the list) I need it to stop.

Any help? I really appreciate it.
 
Seems straightforward. This should work. If your code is already in
a self-contained subroutine, just put in the name of your sub in place
of 'your code here. HTH, James
Sub Test()
For k=6 to 29
if cells(k,"c")="" then
exit for
else
'your code here
end if
Next k
 
Lots of answers

for RowCount = 6 to 29
if isemptry(cells(RowCount,"C")) then exit for

Next RowCount
 
This may work:-

Right clicjk the sheet tab - view code and paste in

Sub stantiate()
Dim myRange As Range
Set myRange = Range("C6:C29")
For Each c In myRange
If c.Value <> "" Then
'<Do your stuff here
End If
Next
End Sub

Mike
 
Thanks

Zone said:
Seems straightforward. This should work. If your code is already in
a self-contained subroutine, just put in the name of your sub in place
of 'your code here. HTH, James
Sub Test()
For k=6 to 29
if cells(k,"c")="" then
exit for
else
'your code here
end if
Next k
 

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

Back
Top