PC Review


Reply
Thread Tools Rate Thread

conditional formatting based on cell contents

 
 
marcia2026
Guest
Posts: n/a
 
      26th Sep 2008
I want to write a simple macro that I can run on any worksheet that will look
for the value "C" in column "B" and if this value exists change the color of
the corresponding cell in column "G" to soft yellow.
Each worksheet will have a variable number of rows.

I don't want to use conditional formatting and copy/paste because I need to
run it every month on a different worksheet, so I want a macro that says for
the "active worksheet" the above happens

thanks in advance
marcia
 
Reply With Quote
 
 
 
 
Sean Timmons
Guest
Posts: n/a
 
      26th Sep 2008
Columns("B:B").Select
Selection.Find(What:="c", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Offset(rowoffset:=0, columnoffset:=5).Activate
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With

"marcia2026" wrote:

> I want to write a simple macro that I can run on any worksheet that will look
> for the value "C" in column "B" and if this value exists change the color of
> the corresponding cell in column "G" to soft yellow.
> Each worksheet will have a variable number of rows.
>
> I don't want to use conditional formatting and copy/paste because I need to
> run it every month on a different worksheet, so I want a macro that says for
> the "active worksheet" the above happens
>
> thanks in advance
> marcia

 
Reply With Quote
 
marcia2026
Guest
Posts: n/a
 
      26th Sep 2008
Hi Sean, It worked great on the 1st one it found, but not any of the ones
after that.

"Sean Timmons" wrote:

> Columns("B:B").Select
> Selection.Find(What:="c", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
> :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> MatchCase:= _
> False, SearchFormat:=False).Activate
> ActiveCell.Offset(rowoffset:=0, columnoffset:=5).Activate
> With Selection.Interior
> .ColorIndex = 6
> .Pattern = xlSolid
> End With
>
> "marcia2026" wrote:
>
> > I want to write a simple macro that I can run on any worksheet that will look
> > for the value "C" in column "B" and if this value exists change the color of
> > the corresponding cell in column "G" to soft yellow.
> > Each worksheet will have a variable number of rows.
> >
> > I don't want to use conditional formatting and copy/paste because I need to
> > run it every month on a different worksheet, so I want a macro that says for
> > the "active worksheet" the above happens
> >
> > thanks in advance
> > marcia

 
Reply With Quote
 
dan dungan
Guest
Posts: n/a
 
      26th Sep 2008
Hi,

I'm using Excel 2000,

When I ran the code in a private sub in the Sheet1 module, it fails on

Selection.Find(What:="c", After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate

with a run time error 448, Named argument not found.

I'm not sure what I've missed.

thanks,

Dan
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional formatting based on length of the cell contents Cats Microsoft Excel Discussion 5 28th May 2010 02:46 PM
Conditional formatting based on a cell's contents Budget Programmer Microsoft Excel Misc 3 23rd Feb 2009 10:35 PM
Conditional Formatting - For 1 cell based on contents of any cell DJH Microsoft Excel Misc 3 12th Sep 2008 10:12 PM
Conditional Formatting a Combo Box based on Contents =?Utf-8?B?VGF0YWthdQ==?= Microsoft Access Forms 1 29th Apr 2006 07:10 PM
Conditional Formatting Based on Contents of a List Raeven Microsoft Excel Misc 3 26th Mar 2004 08:52 PM


Features
 

Advertising
 

Newsgroups
 


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