Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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...

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default 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...



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default 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...


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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...


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Total column changes colors when total equals sum of other columns newstacy New Users to Excel 1 April 21st 07 09:00 PM
how can you highlight or color your total line in a Pivot table R HeidiL Excel Worksheet Functions 1 March 9th 07 12:08 AM
How to click and highlight cells and calculate the total amount in MS Excel? Bon Excel Programming 0 January 5th 07 01:13 PM
When i highlight cells, I USED to get total in bottom rt corner? Barb B Excel Worksheet Functions 2 May 8th 06 02:02 PM
highlight cells to obtain total without using formula? rdavia Excel Discussion (Misc queries) 2 January 18th 05 05:29 PM


All times are GMT +1. The time now is 06:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"