Postive # converted to Negative #

  • Thread starter Thread starter 2MShad
  • Start date Start date
2

2MShad

I want to be able to enter a positive # in a cell and have it display as a
negative? Help
 
I want to be able to enter a positive # in a cell and have it display as a
negative? Help

You can create this sub in the sheet (go to Tools->Macro->Visual Basic
Editor and double click the sheet:

Private Sub Worksheet_Change(ByVal Target As Range)
For Each T In Target
If IsNumeric(T.Value) Then
If T.Value > 0 Then
T.Value = -T.Value
End If
End If
Next
End Sub
 
Be aware that the number is still positive.

All you did was change the display, not the value.

Do not rely on these for calculations.


Gord Dibben MS Excel MVP
 
Be aware that the number is still positive.

All you did was change the display, not the value.

Do not rely on these for calculations.

Gord Dibben  MS Excel MVP




- Show quoted text -

How do you figure that it did not change the value?
T.Value = -T.Value

It looks like it changed the value to me and some simple tests confirm
it.
 
Formatting a number does not change the value of the inputted number.

Enter 1 to 10 in A1:A10

Format as "-"0.0 to display these as negative.

In D1 enter =SUM(A1:A10)

Format D1 as Number or General

I will re-state...............do not rely on the formatted display for
calculations,.


Gord
 
Formatting a number does not change the value of the inputted number.

Enter 1 to 10 in A1:A10

Format as  "-"0.0  to display these as negative.

In D1 enter  =SUM(A1:A10)

Format D1 as Number or General

I will re-state...............do not rely on the formatted display for
calculations,.

Gord







- Show quoted text -

Fair enough. My method however DID change the value. Your method may
be preferable in the OP's case if they did not want the value to
change or if they did not want to have a macro.
 
Back
Top