Hello,
Can anyone help me tweak the code below?
I am using this code to insert a row beneath the header once it finds "Audit_Name".
The code works and it does insert the blank row. However, since the header is shaded blue, I need the new row to be in grey (RGB 217,217,217) OR White, Background 1, Darker 15% ... a light shade of grey. I also need to be Merged and Center from columns B:G and I need it have text that is found in column L (column L is already sorted by various areas) So I need the new row to say something like "NAM" in one section of the header with "Audit_Name" and "ASIA" in the next header section.
So it will be header section1, then subheader section in grey, and then the data for that section (NAM), then header for section 2, subheader section in grey and the data for that section (ASIA).
I need help with the inserted row to convert to grey shading, merge from columns B:G, and label it as what column L has.
Thank you
Can anyone help me tweak the code below?
I am using this code to insert a row beneath the header once it finds "Audit_Name".
The code works and it does insert the blank row. However, since the header is shaded blue, I need the new row to be in grey (RGB 217,217,217) OR White, Background 1, Darker 15% ... a light shade of grey. I also need to be Merged and Center from columns B:G and I need it have text that is found in column L (column L is already sorted by various areas) So I need the new row to say something like "NAM" in one section of the header with "Audit_Name" and "ASIA" in the next header section.
So it will be header section1, then subheader section in grey, and then the data for that section (NAM), then header for section 2, subheader section in grey and the data for that section (ASIA).
I need help with the inserted row to convert to grey shading, merge from columns B:G, and label it as what column L has.
Code:
Dim lRow As Long, iRow As Long
With Worksheets("Report1")
lRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For iRow = lRow To 1 Step -1
If .Cells(iRow, "B").Value = "Audit_Name" Then
'.Rows(iRow).Resize(RowSize:=8).Insert xlShiftDown
'insert 8 rows and move current (iRow) row down (xlShiftDown)
'means: insert 8 rows ABOVE current row (iRow)
.Rows(iRow + 1).Resize(RowSize:=1).Insert xlShiftDown
End If
Next iRow
End With
End Sub
Thank you