I want to insert a blank row above each colored cell when in a column
Under column A I have 5268 records
I want to insert a blank row above a cell that is highlighted yellow. I want to do it till the last value under that column.
Can someone tell me please how to write a vba for?
Thank you in advance for your assistance.
My original code isn't doing what I am asking because instead of inserting just one row, its inserting 5268 rows above the first found highlighted cell.
also, another thing is that I don't want use range actually, because it requires the user to know how many rows of data it has, I want to use a for loop sth like for I = 2 to lastrow?
Under column A I have 5268 records
I want to insert a blank row above a cell that is highlighted yellow. I want to do it till the last value under that column.
Can someone tell me please how to write a vba for?
Thank you in advance for your assistance.
My original code isn't doing what I am asking because instead of inserting just one row, its inserting 5268 rows above the first found highlighted cell.
Code:
Sub Top10()
'lastrow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.Rows.count).Row'
Dim c As range
For Each c In range("A1:A100000")
If c.Interior.Color = 65535 Then
c.Offset(0, 0).EntireRow.Insert
End If
Next c
End Sub
also, another thing is that I don't want use range actually, because it requires the user to know how many rows of data it has, I want to use a for loop sth like for I = 2 to lastrow?