Hello All,
The code I have written is intended to insert a variable number of rows underneath(or above) each existing row based on the number of yellow cells. I have borrowed Functions from cpearson.com to count the number of colored cells in a range.
I keep getting stuck on the line that is supposed to insert the rows. Does anybody have any ideas?
I have not included the code for the Function CountColor but I can if it would be helpful.
Thanks
Mark
The code I have written is intended to insert a variable number of rows underneath(or above) each existing row based on the number of yellow cells. I have borrowed Functions from cpearson.com to count the number of colored cells in a range.
I keep getting stuck on the line that is supposed to insert the rows. Does anybody have any ideas?
Code:
Sub Insertrow()
Dim i As Long
Dim insertnumber As Long
For i = 4433 To 2 Step -1
insertnumber = CountColor(InRange:=Cells(i, 28), ColorIndex:=6)
Rows(i).Select
Selection.Resize(insertnumber).EntireRow.Insert
Next i
End Sub
I have not included the code for the Function CountColor but I can if it would be helpful.
Thanks
Mark