Do Until empty loop
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 |
Do Until empty loop
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 "Kirsty" wrote: 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 |
Do Until empty loop
Thanks,
Works perfectly "JLGWhiz" wrote: 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 "Kirsty" wrote: 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 |
All times are GMT +1. The time now is 06:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com