?
Solved

Conditional Formatting in Excel pre 2007

Posted on 2011-02-17
5
Medium Priority
?
207 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 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 500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

770 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