Solved

Conditional Formatting in Excel pre 2007

Posted on 2011-02-17
5
201 Views
Last Modified: 2012-06-21
Hello, I have a need to apply paint particular cells or rows upon found values in more than three categories per worksheet, so conditional formatting would not work for those using Excel 2003 or earlier version. I tried to use a private sub, it worked but eliminated the undo (ctr-Z) option when editing the worksheet. So I moved the sub to a module and invoke with a button, but then the advantage of dynamic feedback to worksheet user is gone.

Is there a better way to do it with no side effects like that?

Tks, N
-/-
Set Matrix= Range("J2", "J" & n)
For Each cell In Matrix
If cell.Value = "3" Then ' Color it red
Range("J" + CStr(cell.Row) + ":J" + CStr(cell.Row)).Interior.ColorIndex = 3
ElseIf cell.Value = "2" Then ' Color it green
Range("J" + CStr(cell.Row) + ":J" + CStr(cell.Row)).Interior.ColorIndex = 6
ElseIf cell.Value = "1" Then ' Color it green
Range("J" + CStr(cell.Row) + ":J" + CStr(cell.Row)).Interior.ColorIndex = 4
Else ' Remove all color
Range("J" + CStr(cell.Row) + ":J" + CStr(cell.Row)).Interior.ColorIndex = xlNone
End If

Next
0
Comment
Question by:NewToVBA
  • 2
  • 2
5 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 125 total points
ID: 34916093
No. If you use code you lose the Undo stack unless you create your own Undo code.
0
 
LVL 22

Assisted Solution

by:rspahitz
rspahitz earned 125 total points
ID: 34917510
If you only have four choices, use one as your default (starting) choice then use conditional formatting for the other 3 choices.
0
 

Author Comment

by:NewToVBA
ID: 34917901
Hi Rorya,

I have no idea how to write an undo code. Can you assit with it please?

Tks,
N
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 34917952
We would need your full code as the Undo code has to undo whatever you just did.
0
 

Author Comment

by:NewToVBA
ID: 34929148
Well, I guess, there is no solution other than just not using any such code. Then undoing is as good as not doing at all, no?

Tks
N
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now