ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formatting rows based criteria (https://www.excelbanter.com/excel-programming/414259-formatting-rows-based-criteria.html)

Johnny

Formatting rows based criteria
 
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.
--
Johnny

joel

Formatting rows based criteria
 
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


"Johnny" wrote:

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.
--
Johnny



All times are GMT +1. The time now is 07:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com