#1   Report Post  
J Gage
 
Posts: n/a
Default Formatting a cell

How do I formatt a cell or row of cells to return a minus number that will
calculate as minus if I just enter a number? Example= 45.95 returned as
-45.95
Thanks to anyone.
--
J Gage
  #2   Report Post  
Jason Morin
 
Posts: n/a
Default

You can *display* it as negative number through custom
formatting, but the number will still be positive. To
convert it to negative upon cell entry requires VBA.
Something like:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo Exit_Sub
Application.EnableEvents = False
With Target
If Not Intersect(.Cells, Range("A:A")) Is Nothing Then
.Value = .Value * -1
End If
End With
Exit_Sub:
Application.EnableEvents = True
End Sub

---
Right-click on the worksheet tab, View Code, and insert
the code above. The example converts any number entered
into col. A.

HTH
Jason
Atlanta, GA


-----Original Message-----
How do I formatt a cell or row of cells to return a

minus number that will
calculate as minus if I just enter a number? Example=

45.95 returned as
-45.95
Thanks to anyone.
--
J Gage
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell formatting - "" shows as 1/0/1900 seve Excel Discussion (Misc queries) 2 January 16th 05 01:09 AM
How to do a conditional formatting based on an adjacent cell Confused Excel Discussion (Misc queries) 2 January 10th 05 09:55 PM
Excel formatting of text-- one cell needed Jonathan Graham Excel Discussion (Misc queries) 1 December 17th 04 03:56 PM
Cell Formatting jmaulsby Excel Discussion (Misc queries) 1 December 9th 04 03:25 PM
conditional formatting blank cell TREK5200 Excel Discussion (Misc queries) 1 December 6th 04 02:23 AM


All times are GMT +1. The time now is 10:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"