Formatting rows based criteria

  • Thread starter Thread starter Johnny
  • Start date Start date
J

Johnny

Hi Everyone: I am new to VBA and need help. I have tried modifying some
other VBA script without success. I need VBA script to find the Rows in
Column A:A which contain "*Total*" ( EXample *0087 TOTAL) then select columns
A:AQ for that row and formats the cell - Interior light Gray, Dark blue Font
and bold.
 
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 7/18/2008 by Joel
'

'
LastRow = Range("A" & Rows.Count).End(xlUp).Row
Set CompareRange = Range("A1:A" & LastRow)
For Each cell In CompareRange
If InStr(cell.Value, "TOTAL") > 0 Then
With cell.EntireRow
.Font.Bold = True
With .Interior
.ColorIndex = 15
.Pattern = xlSolid
End With
.Font.ColorIndex = 11
End With
End If
Next cell
End Sub
 
Back
Top