+ Reply to Thread
Results 1 to 2 of 2

Formatting a cell

  1. #1
    J Gage
    Guest

    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. #2
    Jason Morin
    Guest

    Re: Formatting a cell

    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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1