View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Can you make a cell always negative without entering a minus each

On Fri, 19 Oct 2007 11:37:02 -0700, JoJoColorado
wrote:

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