Can you make a cell always negative without entering a minus each

G

Guest

I am creating a spreadsheet form where a cell will always be a negative
number. Can I make the cell always negative without having to enter a minus
sign each time?
 
B

Bernard Liengme

No but having entered some numbers in a range you can:
1 type -1 in some empty cell
2 copy the -1 with the Copy tool
3 select the range of numbers to be treated; use Edit | Paste Special and
specify multiply
Now all the positive numbers become negative and the negative ones become
positive
You can now delete the -1
best wishes
 
R

Ron Rosenfeld

I am creating a spreadsheet form where a cell will always be a negative
number. Can I make the cell always negative without having to enter a minus
sign each time?

How do the numbers get into the cells?

If the numbers get there by typing them into the cell, then

Right-click the sheet tab and select View Code
Paste the code below into the window that opens.
Change AOI to reflect the range you wish to always contain negative numbers.

=================================
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim AOI As Range
Set AOI = Range("B3:B1000")
Application.EnableEvents = False
If Not Intersect(Target, AOI) Is Nothing Then
Target.Value = -Abs(Target.Value)
End If
Application.EnableEvents = True
End Sub
=================================

If the numbers are entered in some other fashion, you'll need to let us know.


--ron
 

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