negative number

D

Dave

I got this answer here before but lost it!
How do I get a number to disply as a negative number even if it is entered
as positive?
in other words i enter 45 but -45 appears.
I thought someone gave me a macro for this but i can't find it
thanks
 
J

Jason Morin

Press Ctrl+1, Number tab, click Custom, and insert:

-General;-General

to the right.

HTH
Jason
Atlanta, GA
 
D

Dave

yeah... tried that but can't use it in sums. Doesn't add it correctly.
any other ideas?
thanks
 
H

hcj

see my post under Miscellaneous. Summing seems to work
okay. It looks like you want only the APPEARANCE of a
negative number. Jason's answer was better than mine for
decimal control, but needed to say "-"General;-General
 
D

Dave

Thanks
yeah, I am pretty sure the last time I did this someone came up with a macro
that I could set a range that would behave this way. So that any number
entered would be made negative and would also work as a negative number in
and formulas or sums.
hmmmm....
 
D

Dave

ok... I have narrowed it down...... the workbook says it has a macro in it
when I first open it and if I disable it It wont do the negative number
thing, but when I look in Macros it is not there.... what is up with that?
 
P

Peo Sjoblom

Right click the sheet tab of sheet1 and paste this code

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
For Each c In Worksheets("Sheet1").Range("A1:A10")
If c.Value > 0 Then
c.Value = c.Value * -1
End If
Next c
End Sub

this will convert every positive value to a negative in A1:A10 when
you leave the cell (when you press enter)

--
For everyone's benefit keep the discussion in the newsgroup.

Regards,

Peo Sjoblom
 
D

Dave

thats it!
thanks


Peo Sjoblom said:
Right click the sheet tab of sheet1 and paste this code

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
For Each c In Worksheets("Sheet1").Range("A1:A10")
If c.Value > 0 Then
c.Value = c.Value * -1
End If
Next c
End Sub

this will convert every positive value to a negative in A1:A10 when
you leave the cell (when you press enter)

--
For everyone's benefit keep the discussion in the newsgroup.

Regards,

Peo Sjoblom
 
D

Dave

one last thing.... how do I add another range to that... I have another row
I want to behave the samne way
thanks
 

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