Colouring any cell in worksheet with negative value

S

Shivam.Shah

Hi all,

I have written the below code for making the cells from column to A to
BB fill with red colour, if they have a negative value in them.

I can't seem to make it work. Any help will be appreciated! Thanks
very much!

Shivam

******************************
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const ColumnsToCheck As String = "A:BB"
If Not Intersect(Target, Range(ColumnsToCheck)) Is Nothing Then
If Target.Value < 0 Then
Target.Value.Select
Selection.Interior.ColorIndex = 3
End If
End If
End Sub
 
D

Dave Peterson

Check your other post.

Shivam.Shah said:
Hi all,

I have written the below code for making the cells from column to A to
BB fill with red colour, if they have a negative value in them.

I can't seem to make it work. Any help will be appreciated! Thanks
very much!

Shivam

******************************
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const ColumnsToCheck As String = "A:BB"
If Not Intersect(Target, Range(ColumnsToCheck)) Is Nothing Then
If Target.Value < 0 Then
Target.Value.Select
Selection.Interior.ColorIndex = 3
End If
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top