negative numbers

G

gypsy

can I format a column so that when I type in the number in the cell, it will
automatically appear as a negative. I don't want to always do -_____then the
number.

Thanks.
 
T

T. Valko

Just so the OP is aware.....

That doesn't make the number a negative number. It's just a positive number
with a minus sign in front of it. You would need an event macro to change a
positive number to negative number.

Biff
 
T

Toppers

Thanks Biff. I'll to stop replying in the early morning as my limited brain
isn't in gear.
 
G

Gord Dibben

gypsy

You cannot pre-format the cells as negative.

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


can I format a column so that when I type in the number in the cell, it will
automatically appear as a negative. I don't want to always do -_____then the
number.

Thanks.

Gord Dibben MS Excel MVP
 
Top