HO do I enter a number and have it always appear negative

S

Shorichi

Hi, i want all numbers in a range of cells to appear with a minus but want to
just enter the figures. Is this possible? Cheers
 
J

Jacob Skaria

1. Enter the numbers to the range
2. Once done. enter -1 to a ununsed cell and copy the cell
3. With the copy ON; select the entered range of cells
4. Right click>PasteSpecial>select Multiply> OK.

If this post helps click Yes
 
G

Gord Dibben

Possible with VBA to change the numbers to negative as you enter them.

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

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

Copy/paste the above into that sheet module.

Edit myRange to suit. Alt + q to return to the Excel window.


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