Easy one for you pros (I think).
Is there a way to set up a cell to always display a number typed into
it as a negative number? Thanks for any help.
Display or actually become a negative number?
Display...........Format>Cells>Custom -#,##0.00 but they would still be
positive numbers.
To actually become negative would require VBA.
You could use event code to change them to negative as you enter.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:A10")) Is Nothing Then
With Target
If .Value <> "" Then
.Value = .Value * -1
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
Right-click on the sheet tab and "View Code"
Copy/paste the above into that module.
Edit the range of A1:A10 to suit.
Gord Dibben MS Excel MVP
>Easy one for you pros (I think).
>Is there a way to set up a cell to always display a number typed into
>it as a negative number? Thanks for any help.
jtees4 - 10 Jan 2007 12:26 GMT
Good question. I don't know the answer, it's actually for my wife. I
will get a copy of ther spredsheet later today and see which it is. I
suspect it's "actually become". Thanks for the info either way!
>Display or actually become a negative number?
>
[quoted text clipped - 30 lines]
>>Is there a way to set up a cell to always display a number typed into
>>it as a negative number? Thanks for any help.
jtees4 - 10 Jan 2007 14:36 GMT
>Good question. I don't know the answer, it's actually for my wife. I
>will get a copy of ther spredsheet later today and see which it is. I
[quoted text clipped - 34 lines]
>>>Is there a way to set up a cell to always display a number typed into
>>>it as a negative number? Thanks for any help.
I was wrong. There was actually no need to make it actually
negative...the format thing worked like a charm I just changed it to
show as brackets instead of a negative sign. Thank you!
Gord Dibben - 10 Jan 2007 20:28 GMT
Thanks for the feedback.
Gord
>>Good question. I don't know the answer, it's actually for my wife. I
>>will get a copy of ther spredsheet later today and see which it is. I
[quoted text clipped - 38 lines]
>negative...the format thing worked like a charm I just changed it to
>show as brackets instead of a negative sign. Thank you!