Hi All,
I am looking for a Macro that will format numbers to $m or $k based on the cell's value & if the cell is Negative, format text as Red with brackets.
I have 2 separate below Macros but i want the Macro logic to automatically determine if the number in the cell is in Millions or Thousands (probably some kind of IF, Then macro logic.
Below is the Result i want to achieve.
I am looking for a Macro that will format numbers to $m or $k based on the cell's value & if the cell is Negative, format text as Red with brackets.
I have 2 separate below Macros but i want the Macro logic to automatically determine if the number in the cell is in Millions or Thousands (probably some kind of IF, Then macro logic.
Below is the Result i want to achieve.
Number (before) | Desired Result |
2500000 | $2.5M |
-2500000 | ($2.5M) |
825000 | $825K |
-825000 | ($825K) |
Sub M_Format() | ||
' $M Format | ||
Selection.NumberFormat = "$0.0,,""M""; [Red] ($0.0,,""M)""" | ||
End Sub | ||
Sub K_Format() | ||
' $K Format | ||
Selection.NumberFormat = "$0,""K""; [Red]($0,""K)""" | ||
End Sub |