View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default negative numbers

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


On Thu, 30 Nov 2006 17:47:00 -0800, gypsy
wrote:

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