ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   cell to stay same (https://www.excelbanter.com/excel-discussion-misc-queries/247976-cell-stay-same.html)

Pammy

cell to stay same
 
If I enter a 2 in a cell, I want it to always show as a -2.
Anytime I type 2, if comes in as -2. Is there a way to do this?

Pammy

cell to stay same
 
I want the cell to always be a negative, I misunderstood what was asked me.
Thanks,

"Pammy" wrote:

If I enter a 2 in a cell, I want it to always show as a -2.
Anytime I type 2, if comes in as -2. Is there a way to do this?


Gord Dibben

cell to stay same
 
Only with VBA event code or a helper cell.

Helper cell formula. =A1*-1

Event code.

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:A10"
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Value = .Value * -1
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP

On Mon, 9 Nov 2009 12:09:01 -0800, Pammy
wrote:

I want the cell to always be a negative, I misunderstood what was asked me.
Thanks,

"Pammy" wrote:

If I enter a 2 in a cell, I want it to always show as a -2.
Anytime I type 2, if comes in as -2. Is there a way to do this?




All times are GMT +1. The time now is 03:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com