![]() |
highlight a row when total is in column A
Hello all, I was searching for some excel vba code that would search
column A and if the word Total is found then that row is highlighted with a color, from column A to Column G.. Any suggested vba code? Thanks... |
highlight a row when total is in column A
Do you specifically want to use code ?
I'd suggest Conditional Formatting as an easier option. Regards Trevor "Rock" wrote in message ups.com... Hello all, I was searching for some excel vba code that would search column A and if the word Total is found then that row is highlighted with a color, from column A to Column G.. Any suggested vba code? Thanks... |
highlight a row when total is in column A
For code look in the vba help index for FIND & FINDNEXT
-- Don Guillett Microsoft MVP Excel SalesAid Software "Rock" wrote in message ups.com... Hello all, I was searching for some excel vba code that would search column A and if the word Total is found then that row is highlighted with a color, from column A to Column G.. Any suggested vba code? Thanks... |
highlight a row when total is in column A
Rock,
Try this: Sub test() Dim iEnd As Long, i As Range, iRng As Range iEnd = Cells(Rows.Count, 1).End(xlUp).Row Set iRng = Range(Cells(1, 1), Cells(iEnd, 1)) For Each i In iRng If i.Value = "Total" Then With i.Resize(, 6).Interior .ColorIndex = 36 .Pattern = xlSolid End With End If Next i End Sub -- Dan |
highlight a row when total is in column A
Here is some code using Find/FindNext
Sub ColourTotals() Dim rngFound As Range Dim strFirstAddress As String Set rngFound = Columns("A").Find(What:="total", _ LookAt:=xlPart, _ LookIn:=xlValues, _ MatchCase:=False) If Not rngFound Is Nothing Then strFirstAddress = rngFound.Address Do rngFound.Resize(, 7).Interior.ColorIndex = 40 Set rngFound = Columns("A").FindNext(rngFound) Loop Until rngFound.Address = strFirstAddress End If End Sub -- HTH... Jim Thomlinson "Rock" wrote: Hello all, I was searching for some excel vba code that would search column A and if the word Total is found then that row is highlighted with a color, from column A to Column G.. Any suggested vba code? Thanks... |
All times are GMT +1. The time now is 04:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com