negative number

  • Thread starter Thread starter D
  • Start date Start date
D

D

I have a spreadsheet with some cells that will be displaying currency....
All the entries in these cells are going to be negative numbers. Is there
anyway to auotmatically have any number entered come up as a negative
number. Just in case i forget to do it manually........
 
You can use the change event of the sheet.
Rightclick the sheet tab and choose "Show code"
(or similar).
Enter the below code in the righthand window.
Adjust CheckRange to the range at hand.

Private Sub Worksheet_Change(ByVal Target As Range)
'Leo Heuser, 25-3-2004
Dim Cell As Range
Dim CheckRange As Range
Set CheckRange = Range("A1:C10")

If Union(CheckRange, Target).Address = _
Union(CheckRange, CheckRange).Address Then

If Target.Cells(1).Value > 0 Then
For Each Cell In Target.Cells
Cell.Value = Cell.Value * -1
Next Cell
End If
End If

End Sub
 
I do not know of a way to do this, but if you format the
cells involved to show negative numbers in red then you
can easily spot a positive number.

Charlie O'Neill
 

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

Back
Top