View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Format cell to show '-'

.Value = -.Value

While I am not sure I got an answer to my negative number question, assuming
positive and negative values can be entered and that the OP meant it when he
said "If any number is entered, it will be seen as a negative number..",
then perhaps the above line should read this way...

..Value = -Abs(.Value)

--
Rick (MVP - Excel)


"Gary''s Student" wrote in message
...
Enter the following event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
With Target
.Value = -.Value
End With
Application.EnableEvents = True
End Sub


Because it is worksheet code, it is very easy to install and automatic to
use:

1. right-click the tab name near the bottom of the Excel window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you have any concerns, first try it on a trial worksheet.

If you save the workbook, the macro will be saved with it.


To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm

--
Gary''s Student - gsnu200852


"Gary" wrote:

they do not have to display as negative, but I want them to function as
negative. If any number is entered, it will be seen as a negative number
by
formula referencing that cell.

Thanks,
Gary

"Rick Rothstein" wrote:

Can there be actual negative values in your cells and, if so, how
should
they display?

--
Rick (MVP - Excel)


"Gary" wrote in message
...
Looking for a way to make entries into cell show negative (-)
indicator by
default. For instance if '1' is entered, it will display '-1'.
Excel 2003