View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
matt matt is offline
external usenet poster
 
Posts: 73
Default HOW TO USE REPLACE OR CREATE A MACRO TO HIGHTLIGHT THE NEGATIVE VA

On Mar 19, 1:08 pm, VARSANG wrote:
I HAVE COLUMNS FULL OF MIX NUMBERS. I WAOULD LIKE TO HIGHTLIGHT THE NEGATIVE
NUMBERS BY RUNNING THE MACRO. THE REPLACE DOESNT HAVE A LOOK IN VALUE CHOICE.
CAN SOMEONE PLEASE HELP ME WITH THIS??


Varsang,

You can look into doing conditional formatting in the Excel
application.

In VBA you can do something like the following (provided that your
data is contiguous).

Option Explicit

Sub colorMacro()
Dim a
Dim counter

counter = Range("a1").CurrentRegion.Rows.Count

For a = 1 To counter
If Range("a" & a).Value < 0 Then
Range("a" & a).Interior.ColorIndex = 3
End If
Next

End Sub

Matt