ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I set up automatic color change on negativ numbers in Excel (https://www.excelbanter.com/excel-discussion-misc-queries/162515-how-do-i-set-up-automatic-color-change-negativ-numbers-excel.html)

Salle

How do I set up automatic color change on negativ numbers in Excel
 


Bob I

How do I set up automatic color change on negativ numbers inExcel
 
Format, Cells, Number, pick the red format.

Salle wrote:


iliace

How do I set up automatic color change on negativ numbers in Excel
 
Precede the second portion of the number format with any of these
colors:
[BLACK], [BLUE], [CYAN], [GREEN], [MAGENTA], [RED], [WHITE], [YELLOW]

If you don't see one you need there, you can use any of the
InteriorColor numbers by using [COLOR n].

Use this VBA routine to figure out which color number corresponds to
which color. It will correspond to the row number.

Sub generateInteriorColors()
Dim i As Long
Dim wsh As Excel.Worksheet

Set wsh = Application.ActiveWorkbook.Worksheets.Add
On Error Resume Next
wsh.Name = "Interior Colors"
If Err.Number < 0 Then
Application.DisplayAlerts = False
wsh.Delete
Application.DisplayAlerts = True
Application.ActiveWorkbook.Worksheets("Interior
Colors").Activate
Exit Sub
End If

For i = 1 To 56
wsh.Cells(i, 1).Interior.ColorIndex = i
wsh.Cells(i, 2).NumberFormat = "$#,##0.00_);[Color " & i & "]
($#,##0.00)"
wsh.Cells(i, 2).Value = -i
Next i
End Sub


On Oct 17, 4:48 pm, Salle wrote:




anu

How do I set up automatic color change on negativ numbers in E
 
HAve you tried conditional formatting fro the same..
Anu

"iliace" wrote:

Precede the second portion of the number format with any of these
colors:
[BLACK], [BLUE], [CYAN], [GREEN], [MAGENTA], [RED], [WHITE], [YELLOW]

If you don't see one you need there, you can use any of the
InteriorColor numbers by using [COLOR n].

Use this VBA routine to figure out which color number corresponds to
which color. It will correspond to the row number.

Sub generateInteriorColors()
Dim i As Long
Dim wsh As Excel.Worksheet

Set wsh = Application.ActiveWorkbook.Worksheets.Add
On Error Resume Next
wsh.Name = "Interior Colors"
If Err.Number < 0 Then
Application.DisplayAlerts = False
wsh.Delete
Application.DisplayAlerts = True
Application.ActiveWorkbook.Worksheets("Interior
Colors").Activate
Exit Sub
End If

For i = 1 To 56
wsh.Cells(i, 1).Interior.ColorIndex = i
wsh.Cells(i, 2).NumberFormat = "$#,##0.00_);[Color " & i & "]
($#,##0.00)"
wsh.Cells(i, 2).Value = -i
Next i
End Sub


On Oct 17, 4:48 pm, Salle wrote:






All times are GMT +1. The time now is 02:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com