Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ddd ddd is offline
external usenet poster
 
Posts: 1
Default Polish my code, please


Hi - trying to hammer out a macro (see below). If any values in Column C
contain any one of the following values: "Consent Order" or "Review" or
varying characters containing the word "Closed"....thought a wildcard
around Closed would take care of that, then I want the font color for
all the values in that particular row(s) to turn red.

Below is what I've hammered out (don't laugh :) )......it's not
working so sure would appreciate some help. THANK YOU.

Dim myrange
myrange = ActiveSheet.Columns("c").Value
If myrange = ["review", "consent order", "*closed*"] Then
ActiveSheet.Rows.Select
Selection.Font.Color = vbRed
End If
End Sub


--
ddd
------------------------------------------------------------------------
ddd's Profile: http://www.excelforum.com/member.php...o&userid=31068
View this thread: http://www.excelforum.com/showthread...hreadid=507521

  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Polish my code, please

I think this will do what you want:

Sub Test2()
Dim MyRange As Range
Dim x As Range
Set MyRange = Application.Intersect(ActiveSheet.UsedRange, _
Columns("C"))

For Each x In MyRange
If x.Value = "review" Or _
x.Value = "consent order" Or _
x.Value Like "*closed*" Then _
Rows(x.Row).Font.Color = vbRed
Next x
End Sub

"ddd" wrote:


Hi - trying to hammer out a macro (see below). If any values in Column C
contain any one of the following values: "Consent Order" or "Review" or
varying characters containing the word "Closed"....thought a wildcard
around Closed would take care of that, then I want the font color for
all the values in that particular row(s) to turn red.

Below is what I've hammered out (don't laugh :) )......it's not
working so sure would appreciate some help. THANK YOU.

Dim myrange
myrange = ActiveSheet.Columns("c").Value
If myrange = ["review", "consent order", "*closed*"] Then
ActiveSheet.Rows.Select
Selection.Font.Color = vbRed
End If
End Sub


--
ddd
------------------------------------------------------------------------
ddd's Profile: http://www.excelforum.com/member.php...o&userid=31068
View this thread: http://www.excelforum.com/showthread...hreadid=507521


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Polish my code, please


I'm sure there are better ways to do it, but this seemed to work.

Note I limited it to rows 1:100 in column C

Sub macro1()
Dim rng As Range
For i = 1 To 100
Set rng = Cells(i, 3).Find("review")
If rng Is Nothing Then GoTo trynext
myrow = rng.Row
GoTo setcolor
trynext:
Set rng = Cells(i, 3).Find("consent order")
If rng Is Nothing Then GoTo trynext1
myrow = rng.Row
GoTo setcolor
trynext1:
Set rng = Cells(i, 3).Find("closed")
If rng Is Nothing Then GoTo nextrow
myrow = rng.Row
setcolor:
Rows(myrow).Select
Selection.Font.Color = vbRed
nextrow:
Next i
End Sub


--
duane


------------------------------------------------------------------------
duane's Profile: http://www.excelforum.com/member.php...o&userid=11624
View this thread: http://www.excelforum.com/showthread...hreadid=507521

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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Networkdays function is not working between Danish and a Polish PC NissenPL Excel Discussion (Misc queries) 2 November 2nd 06 03:53 PM
Why do the cells I am custom formatting save in special, polish Drm2B Excel Worksheet Functions 0 August 8th 05 10:27 PM
stubborn Excel crash when editing code with code, one solution Brian Murphy Excel Programming 0 February 20th 05 05:56 AM


All times are GMT +1. The time now is 01:10 PM.

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"