Solved

Extremely easy question.

Posted on 2004-09-30
2
211 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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

773 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