Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default color row using macro..

Hi,
Is there any way to use a macro to find a word example "Total" in a
column example "C:C" and when it finds the word it will color that row
say "Blue" and then find next and if find more do the same all the way
to the end of the column.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default color row using macro..

Hi,

Right click your sheet tab, view code and paste this in and run it

Sub marine()
Dim myrange, MyRange1 As Range
lastrow = Cells(Rows.Count, "C").End(xlUp).Row
Set myrange = Range("C1:C" & lastrow)
For Each c In myrange
If UCase(c.Value) = "TOTAL" Then
If MyRange1 Is Nothing Then
Set MyRange1 = c.EntireRow
Else
Set MyRange1 = Union(MyRange1, c.EntireRow)
End If
End If
Next
MyRange1.Interior.ColorIndex = 41
End Sub

Mike

" wrote:

Hi,
Is there any way to use a macro to find a word example "Total" in a
column example "C:C" and when it finds the word it will color that row
say "Blue" and then find next and if find more do the same all the way
to the end of the column.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default color row using macro..

try this. change sheet25 to suit the name of your sheet and 500 to suit your
last row

Sub colortotalrow()
With Worksheets("sheet25").Range("c1:c500")
Set c = .Find("Total", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Rows(c.Row).Interior.ColorIndex = 6
Set c = .FindNext(c)
Loop While Not c Is Nothing _
And c.Address < firstAddress
End If
End With

End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
...
Hi,
Is there any way to use a macro to find a word example "Total" in a
column example "C:C" and when it finds the word it will color that row
say "Blue" and then find next and if find more do the same all the way
to the end of the column.

Thanks


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default color row using macro..

On Jun 21, 6:45*am, "Don Guillett" wrote:
try this. change sheet25 to suit the name of your sheet and 500 to suit your
last row

Sub colortotalrow()
With Worksheets("sheet25").Range("c1:c500")
* * Set c = .Find("Total", LookIn:=xlValues)
* * If Not c Is Nothing Then
* * * * firstAddress = c.Address
* * * * Do
* * * * *Rows(c.Row).Interior.ColorIndex = 6
* * * * Set c = .FindNext(c)
* * * * Loop While Not c Is Nothing _
* * * * And c.Address < firstAddress
* * End If
End With

End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message

...



Hi,
Is there any way to use a macro to find a word example "Total" in a
column example "C:C" and when it finds the word it will color that row
say "Blue" and then find next and if find more do the same all the way
to the end of the column.


Thanks- Hide quoted text -


- Show quoted text -


Hi,
Thanks it works great. Can I make another macro or add to this one,
I need the macro to first find the "Total" in "C:C" then clear the
Borders in that ROW and then place a border on top and bottom of that
ROW and if any cell in that ROW is not empty place a OUTLINE Border.
Thanks
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default color row using macro..

Please TOP post with me

Sub colortotalrow()
With Worksheets("sheet25").Range("c1:c500")
Set c = .Find("Total", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
With Rows(c.Row)
.Interior.ColorIndex = 6
.BorderAround , Weight:=xlMedium
End With
Set c = .FindNext(c)
Loop While Not c Is Nothing _
And c.Address < firstAddress
End If
End With

End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
...
On Jun 21, 6:45 am, "Don Guillett" wrote:
try this. change sheet25 to suit the name of your sheet and 500 to suit
your
last row

Sub colortotalrow()
With Worksheets("sheet25").Range("c1:c500")
Set c = .Find("Total", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Rows(c.Row).Interior.ColorIndex = 6
Set c = .FindNext(c)
Loop While Not c Is Nothing _
And c.Address < firstAddress
End If
End With

End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message

...



Hi,
Is there any way to use a macro to find a word example "Total" in a
column example "C:C" and when it finds the word it will color that row
say "Blue" and then find next and if find more do the same all the way
to the end of the column.


Thanks- Hide quoted text -


- Show quoted text -


Hi,
Thanks it works great. Can I make another macro or add to this one,
I need the macro to first find the "Total" in "C:C" then clear the
Borders in that ROW and then place a border on top and bottom of that
ROW and if any cell in that ROW is not empty place a OUTLINE Border.
Thanks



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default color row using macro..

On Jun 21, 10:19*am, wrote:
On Jun 21, 6:45*am, "Don Guillett" wrote:

try this. change sheet25 to suit the name of your sheet and 500 to suit your
last row


Sub colortotalrow()
With Worksheets("sheet25").Range("c1:c500")
* * Set c = .Find("Total", LookIn:=xlValues)
* * If Not c Is Nothing Then
* * * * firstAddress = c.Address
* * * * Do
* * * * *Rows(c.Row).Interior.ColorIndex = 6
* * * * Set c = .FindNext(c)
* * * * Loop While Not c Is Nothing _
* * * * And c.Address < firstAddress
* * End If
End With


End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message


...


Hi,
Is there any way to use a macro to find a word example "Total" in a
column example "C:C" and when it finds the word it will color that row
say "Blue" and then find next and if find more do the same all the way
to the end of the column.








Hi,
Thanks it works great. Can I make another macro or add to this one,
I need the macro to first find the "Total" in "C:C" then clear the
Borders in that ROW and then place a border on top and bottom of that
ROW and if any cell in that ROW is not empty place a OUTLINE Border.
Thanks

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default color row using macro..

On Jun 21, 11:38*am, "Don Guillett" wrote:
Did you NOT see my last post with the change and the request to TOP POST

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message

...
On Jun 21, 10:19 am, wrote:





On Jun 21, 6:45 am, "Don Guillett" wrote:


try this. change sheet25 to suit the name of your sheet and 500 to suit
your
last row


Sub colortotalrow()
With Worksheets("sheet25").Range("c1:c500")
Set c = .Find("Total", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Rows(c.Row).Interior.ColorIndex = 6
Set c = .FindNext(c)
Loop While Not c Is Nothing _
And c.Address < firstAddress
End If
End With


End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message


....


Hi,
Is there any way to use a macro to find a word example "Total" in a
column example "C:C" and when it finds the word it will color that row
say "Blue" and then find next and if find more do the same all the way
to the end of the column.


Hi,
Thanks it works great. Can I make another macro or add to this one,
I need the macro to first find the "Total" in "C:C" then clear the
Borders in that ROW and then place a border on top and bottom of that
ROW and if any cell in that ROW is not empty place a OUTLINE Border.
Thanks- Hide quoted text -

- Show quoted text -


Hi,
What is a top post?
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default color row using macro..

On Jun 21, 11:38*am, "Don Guillett" wrote:
Did you NOT see my last post with the change and the request to TOP POST

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message

...
On Jun 21, 10:19 am, wrote:





On Jun 21, 6:45 am, "Don Guillett" wrote:


try this. change sheet25 to suit the name of your sheet and 500 to suit
your
last row


Sub colortotalrow()
With Worksheets("sheet25").Range("c1:c500")
Set c = .Find("Total", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Rows(c.Row).Interior.ColorIndex = 6
Set c = .FindNext(c)
Loop While Not c Is Nothing _
And c.Address < firstAddress
End If
End With


End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message


....


Hi,
Is there any way to use a macro to find a word example "Total" in a
column example "C:C" and when it finds the word it will color that row
say "Blue" and then find next and if find more do the same all the way
to the end of the column.


Hi,
Thanks it works great. Can I make another macro or add to this one,
I need the macro to first find the "Total" in "C:C" then clear the
Borders in that ROW and then place a border on top and bottom of that
ROW and if any cell in that ROW is not empty place a OUTLINE Border.
Thanks- Hide quoted text -

- Show quoted text -


Yes, I see know. Thanks.
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default color row using macro..

Hi,
Thanks, Now I got the Top Post!
How about if any cell in that ROW that we colored that is not empty
place a OUTLINE Border, not only the top and bottom but the sides too
for those cells that are not empty.
Thanks.





On Jun 21, 11:38*am, "Don Guillett" wrote:
Did you NOT see my last post with the change and the request to TOP POST

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message

...
On Jun 21, 10:19 am, wrote:





On Jun 21, 6:45 am, "Don Guillett" wrote:


try this. change sheet25 to suit the name of your sheet and 500 to suit
your
last row


Sub colortotalrow()
With Worksheets("sheet25").Range("c1:c500")
Set c = .Find("Total", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Rows(c.Row).Interior.ColorIndex = 6
Set c = .FindNext(c)
Loop While Not c Is Nothing _
And c.Address < firstAddress
End If
End With


End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message


....


Hi,
Is there any way to use a macro to find a word example "Total" in a
column example "C:C" and when it finds the word it will color that row
say "Blue" and then find next and if find more do the same all the way
to the end of the column.


Hi,
Thanks it works great. Can I make another macro or add to this one,
I need the macro to first find the "Total" in "C:C" then clear the
Borders in that ROW and then place a border on top and bottom of that
ROW and if any cell in that ROW is not empty place a OUTLINE Border.
Thanks- Hide quoted text -

- Show quoted text -




  #11   Report Post  
Posted to microsoft.public.excel.programming
j j j j is offline
external usenet poster
 
Posts: 1
Default color row using macro..



Sub Macro1()


For x = 3 To 1500
For y = 3 To 1500
If Cells(x, 2).Value = Cells(y, 6).Value Then
Cells(x, 7).Value = "true"
Cells(x, 3).Interior.ColorIndex = 36
Cells(x, 8).Value = y
Cells(y, 4).Interior.ColorIndex = 36

Else
End If
Next y
Next x


End Sub

*** Sent via Developersdex http://www.developersdex.com ***
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
Color macro Little Penny Excel Programming 11 September 23rd 07 05:04 PM
Make text color match cell color with macro? JoeSpareBedroom Excel Discussion (Misc queries) 1 June 26th 07 07:09 PM
Macro - color tab Rob Excel Discussion (Misc queries) 7 September 20th 06 01:49 PM
Color Row Macro Problem, adapted from Patrick Malloy macro SteveC Excel Programming 4 June 21st 06 12:28 PM
macro color change Dan Excel Worksheet Functions 0 February 15th 05 09:35 PM


All times are GMT +1. The time now is 07:08 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"