Column of negative numbers

M

MS

Is it possible to highlight and format a part of a column before entering
data so that whatever entered is a negative number? This way i do not have
to press the minus sign before entering the number.

Thank u
ms
 
S

Sandy Mann

You could format the column to look like negative numbers but the numbers
would still be positive. Much better to enter them as positive and then
change them by entering -1 in an empty cell, copying it, highlighting the
column and the selecting Paste Special > Multiply


--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk
 
G

Gord Dibben

If you truly want them to be negative you could use event code that would
multiply them by -1 when entered.

Private Sub Worksheet_Change(ByVal Target As Range)
Const MY_RANGE As String = "A1:A10"
On Error GoTo endit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(MY_RANGE)) Is Nothing Then
Target.Value = Target.Value * -1
End If
endit:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code".

Copy/paste into that sheet module.

Adjust MY_RANGE to suit.


Gord Dibben MS Excel MVP
 
M

MS

Thank you Sandy

Sandy Mann said:
You could format the column to look like negative numbers but the numbers
would still be positive. Much better to enter them as positive and then
change them by entering -1 in an empty cell, copying it, highlighting the
column and the selecting Paste Special > Multiply


--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk
 
M

MS

Thank you Gord.
MS

Gord Dibben said:
If you truly want them to be negative you could use event code that would
multiply them by -1 when entered.

Private Sub Worksheet_Change(ByVal Target As Range)
Const MY_RANGE As String = "A1:A10"
On Error GoTo endit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(MY_RANGE)) Is Nothing Then
Target.Value = Target.Value * -1
End If
endit:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code".

Copy/paste into that sheet module.

Adjust MY_RANGE to suit.


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top