Have a 3 column 2500 row Excel 2007 worksheet;
Name---Type------Value
Jane---Cost------1234
Jill---Service---1234
Is it possible to auto-format the figures in the column titled "Value" conditional on what is in the second column.
For example, if "Cost' is in the second column, the figure in the column titled "Value" should be formatted as Currency with two decimal places. If "Service" is in the second column, the figure in the column titled "Value" should be formatted as a general number without any decimal places.
did create the following, but decided to post to gather additional insight to determine if I am on the right path.
Is this how you would tackle this?
Any additional insight is appreciated.
Name---Type------Value
Jane---Cost------1234
Jill---Service---1234
Is it possible to auto-format the figures in the column titled "Value" conditional on what is in the second column.
For example, if "Cost' is in the second column, the figure in the column titled "Value" should be formatted as Currency with two decimal places. If "Service" is in the second column, the figure in the column titled "Value" should be formatted as a general number without any decimal places.
did create the following, but decided to post to gather additional insight to determine if I am on the right path.
Is this how you would tackle this?
Any additional insight is appreciated.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, [A1]) Is Nothing Then
Set RNG = Range("B2:B2500")
Select Case Target
Case "Cost"
RNG.NumberFormat = "#,##0.00;[Red]-[$809]#,##0.00"
Case "Service"
RNG.NumberFormat = "#,##000 [$€-1];[Red]-#,##0.00 [$€-1]" End Select
End If
End Sub