Do Until empty loop

K

Kirsty

All,

I have been trying to write a loop macro that will insert a star every 6
rows in column C until there are no values in column B.

So far I can get it to insert only the first star, know I am missing
something but not sure what. This is what I have

Range("B7").Select 'Set range to start point
Do While ActiveCell.Value <> ""
ActiveCell.Offset(0, 1).FormulaR1C1 = "*"
ActiveCell.Offset(1, -1).Select
Loop

Kirsty
 
J

JLGWhiz

You can insert this into your code by removing the first and last lines.

Sub sixrowtest()
lastRow = Cells(Rows.Count, 2).End(xlUp).Row
For i = 7 To lastRow Step 8
If Cells(i, 2) <> "" Then
Cells(i, 3) = "*"
End If
Next
End Sub
 
K

Kirsty

Thanks,

Works perfectly

JLGWhiz said:
You can insert this into your code by removing the first and last lines.

Sub sixrowtest()
lastRow = Cells(Rows.Count, 2).End(xlUp).Row
For i = 7 To lastRow Step 8
If Cells(i, 2) <> "" Then
Cells(i, 3) = "*"
End If
Next
End Sub
 

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