PC Review


Reply
Thread Tools Rate Thread

Cell Formatting with a macro...

 
 
MOC835
Guest
Posts: n/a
 
      29th May 2007
Related to a previous topic.

I have a worksheet that uses conditional formatting. However, I need
to add a 4th condition. I need to code a macro that checks the
content of a cell, and then changes the formating (color) of a range
of cells if the condition is met.

For example if cell M1 is populated with an 'X', then I want excel to
change the color of the cells (pattern) for the range A1:M1.

Basically, the macro will check for values in the M column and
highlight all the cells in the intersecting row.

I used conditional formating to perform other tasks, but since Excel
only supports 3 conditions (4 if you count the initial/default
condition) now I need a macro!

Please help.

 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      29th May 2007
Basic idea. Incorporate into a worksheet_change event for it to be
automatic.

Sub selectcaseformatting()
Select Case ActiveCell.Value
Case 1: x = 3
Case 22: x = 5
Case 31: x = 6
Case 46: x = 8
Case Else
End Select
ActiveCell.Interior.ColorIndex = x
End Sub

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"MOC835" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Related to a previous topic.
>
> I have a worksheet that uses conditional formatting. However, I need
> to add a 4th condition. I need to code a macro that checks the
> content of a cell, and then changes the formating (color) of a range
> of cells if the condition is met.
>
> For example if cell M1 is populated with an 'X', then I want excel to
> change the color of the cells (pattern) for the range A1:M1.
>
> Basically, the macro will check for values in the M column and
> highlight all the cells in the intersecting row.
>
> I used conditional formating to perform other tasks, but since Excel
> only supports 3 conditions (4 if you count the initial/default
> condition) now I need a macro!
>
> Please help.
>


 
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
Non-macro method (like conditional formatting) to insert text in cell? Ed from AZ Microsoft Excel Discussion 7 15th Nov 2010 05:16 PM
Help with cell formatting in macro. Pank Microsoft Excel New Users 7 26th Sep 2008 08:07 AM
Return cell(s) Conditional Formatting Status via a macro JudgeMental Microsoft Excel Programming 3 15th Mar 2008 07:34 PM
Cell Formatting w/following Macro RudeRam Microsoft Excel Misc 1 26th Jun 2006 04:37 PM
Macro to move cell contents based on formatting =?Utf-8?B?U2NvdHQgV2FnbmVy?= Microsoft Excel Programming 2 23rd Dec 2005 03:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:12 PM.