Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default conditional formatting based on cell contents

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,696
Default conditional formatting based on cell contents

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default conditional formatting based on cell contents

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 411
Default conditional formatting based on cell contents

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
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
Conditional formatting based on a cell's contents Budget Programmer Excel Discussion (Misc queries) 3 February 23rd 09 10:35 PM
Conditional Formatting - For 1 cell based on contents of any cell DJH Excel Discussion (Misc queries) 3 September 12th 08 10:12 PM
Formatting one cell based on the contents of another 2007-User Excel Discussion (Misc queries) 0 June 19th 07 08:13 AM
Formatting one cell based on the contents of another [email protected] Excel Discussion (Misc queries) 4 April 13th 07 06:15 PM
Conditional Format based on contents of cell. dave m Excel Worksheet Functions 13 April 29th 05 01:12 PM


All times are GMT +1. The time now is 03:13 PM.

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

About Us

"It's about Microsoft Excel"