Solved

Extremely easy question.

Posted on 2004-09-30
2
209 Views
Last Modified: 2010-05-02
I am calculating ratings thru VB6.  I opened an excel worksheet, and as I am filling in the information, if a rating is higher than a target I want to fill that cells backcolor green, if lower, I want it to be red.  

I have been fighting this for a bit, and don't have the patience to look any longer.  Any help would be greatly appreciated.  Therefore, even though I know it is easy, I am giving 125 points instead of 50.

TIA,
DMM
0
Comment
Question by:dmmorse
2 Comments
 
LVL 32

Accepted Solution

by:
Erick37 earned 125 total points
ID: 12193107
A couple ways:

Sheet1.Range("A1:A1").Interior.Color = vbGreen
=or=
ActiveCell.Interior.Color = vbRed
0
 
LVL 5

Expert Comment

by:jmacmicking
ID: 12193554
Another option; Excel supports conditional formating.  If the target is fixed you can just set this for the whole column and let Excel do the grunt work.  The version of Excel I'm using (2002) has Conditional Formating listed under the Format menu.  If you've got an existing workbook just set it there and forget it.  If you're creating the workbook on the fly lemme know and I can lookup the appropriate object (or just use Erick37's suggestion, above)
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

708 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

17 Experts available now in Live!

Get 1:1 Help Now