SET DEFAULT VALUES IN CELL TO RECORD NEGATIVE

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to set the deufault values of a range of cells in my spread
sheet to negative.

EXAMPLE - If I had to type in -212, when I type in the cell 212 it should
autmatically record the same as -212.

Is there a way I can set the cell values so ths can be accomplished

Prasad
 
No but you can type a range of numbers, then in an unused cell (say Z1)
enter -1
Copy Z1
Select all of the aforesaid range, use Edit |Paste Special and check the
Multiple box, click OK
Now delete Z1
done
best wishes
 
You cannot pre-format the cells as negative.

You could use event code to change them to negative as you enter.

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

Right-click on the sheet tab and "View Code"

Copy/paste the above into that module.

Edit the range of A1:A10 to suit.


Gord Dibben MS Excel MVP
 
Format > Category Custom and use ##"-"##

Gord Dibben said:
You cannot pre-format the cells as negative.

You could use event code to change them to negative as you enter.

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

Right-click on the sheet tab and "View Code"

Copy/paste the above into that module.

Edit the range of A1:A10 to suit.


Gord Dibben MS Excel MVP
 
Back
Top