[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

How do i color in macro/VBA collumn H to green if its furmula value is less then zero and to red if its greater then zero?

Posted on 2011-04-28
4
Medium Priority
?
267 Views
Last Modified: 2012-08-14
Thanks
Gvilbis
0
Comment
Question by:gvilbis
  • 2
4 Comments
 
LVL 33

Assisted Solution

by:jppinto
jppinto earned 160 total points
ID: 35481376
Do you need it to be a macro or it can be done using conditional formatting?
0
 

Author Comment

by:gvilbis
ID: 35481451
I need it as macro

thanks
0
 

Author Comment

by:gvilbis
ID: 35482089
Please advice
0
 
LVL 30

Accepted Solution

by:
SiddharthRout earned 1840 total points
ID: 35482182
Try this Sample File.

Sid

Code Used

Private Sub Worksheet_Change(ByVal Target As Range)
    Application.EnableEvents = False
    
    On Error GoTo Whoa
    
    If Not Intersect(Target, Columns(8)) Is Nothing Then
        Select Case Target.Value
        
        Case Is < 0
            Target.Interior.ColorIndex = 10
        Case Is > 0
            Target.Interior.ColorIndex = 3
        Case Else
            Target.Interior.Pattern = xlNone
        End Select
    End If
LetsContinue:
    Application.EnableEvents = True
    Exit Sub
Whoa:
    MsgBox Err.Description
    Resume LetsContinue
End Sub

Open in new window

Color-Cells.xls
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

608 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