Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
SET DEFAULT VALUES IN CELL TO RECORD NEGATIVE
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
SET DEFAULT VALUES IN CELL TO RECORD NEGATIVE
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 -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "Prasad Gopinath" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
SET DEFAULT VALUES IN CELL TO RECORD NEGATIVE
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 On Thu, 23 Nov 2006 10:48:02 -0800, Prasad Gopinath wrote: 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 |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
SET DEFAULT VALUES IN CELL TO RECORD NEGATIVE
Format Category Custom and use ##"-"##
"Gord Dibben" wrote: 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 On Thu, 23 Nov 2006 10:48:02 -0800, Prasad Gopinath wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using an offset formula for the reference in a relative reference | Excel Worksheet Functions | |||
Compiling macro based on cell values | Excel Discussion (Misc queries) | |||
Custom functions calculating time arguments Help Desperate | Excel Worksheet Functions | |||
Cell linked to a range of cell values in different sheet | Excel Discussion (Misc queries) | |||
Copy cell format to cell on another worksht and update automatical | Excel Worksheet Functions |