ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   HO do I enter a number and have it always appear negative (https://www.excelbanter.com/excel-discussion-misc-queries/233510-ho-do-i-enter-number-have-always-appear-negative.html)

Shorichi

HO do I enter a number and have it always appear negative
 
Hi, i want all numbers in a range of cells to appear with a minus but want to
just enter the figures. Is this possible? Cheers

Jacob Skaria

HO do I enter a number and have it always appear negative
 
1. Enter the numbers to the range
2. Once done. enter -1 to a ununsed cell and copy the cell
3. With the copy ON; select the entered range of cells
4. Right clickPasteSpecialselect Multiply OK.

If this post helps click Yes
---------------
Jacob Skaria


"Shorichi" wrote:

Hi, i want all numbers in a range of cells to appear with a minus but want to
just enter the figures. Is this possible? Cheers


Gord Dibben

HO do I enter a number and have it always appear negative
 
Possible with VBA to change the numbers to negative as you enter them.

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

This is sheet event code. Right-click on sheet tab and "View Code".

Copy/paste the above into that sheet module.

Edit myRange to suit. Alt + q to return to the Excel window.


Gord Dibben MS Excel MVP

On Wed, 10 Jun 2009 19:24:09 -0700, Shorichi
wrote:

Hi, i want all numbers in a range of cells to appear with a minus but want to
just enter the figures. Is this possible? Cheers




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

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