
Originally Posted by
saravanan1981
No_Annualised_Claims
No_Annualised_Claims_With_IBNR
Annualised_Claim_Amount
Annualised_Claim_Amount_With_IBNR
Age_Band_1
Age_Band_2
Age_Band_3
Age_Band_4
Age_Band_5
Amount_Band
Question... are the above headers the only headers that have red bold font in a yellow filled cell? If so, here is another macro that you can consider...
Sub DeleteHeadersWithYellowFillAndRedBoldFont()
With Application.FindFormat
.Clear
.Interior.Color = vbYellow
.Font.Bold = True
.Font.Color = vbRed
Rows(1).Replace "", "#N/A", , , , , True, False
.Clear
End With
On Error Resume Next
Rows(1).SpecialCells(xlConstants, xlErrors).EntireColumn.Delete
With Cells(1, Columns.Count).End(xlToLeft).Offset(, 1).Resize(, 10)
.Value = Array("No_Annualised_Claims", "No_Annualised_Claims_With_IBNR", "Annualised_Claim_Amount", "Annualised_Claim_Amount_With_IBNR", "Age_Band_1", "Age_Band_2", "Age_Band_3", "Age_Band_4", "Age_Band_5", "Amount_Band")
.Interior.Color = vbYellow
.Font.Color = vbRed
.Font.Bold = True
.EntireColumn.AutoFit
End With
End Sub
Note: If those headers are the only header with yellow fill, then you can remove the two lines of code I highlighted in red above.
Bookmarks