+ Reply to Thread
Results 1 to 3 of 3

numberformat with cell reference for negative numbers

  1. #1
    Registered User
    Join Date
    08-24-2011
    Location
    london,England
    MS-Off Ver
    Excel 2007
    Posts
    1

    numberformat with cell reference for negative numbers

    Hi,

    I'm trying to format a cell with reference to another cell and would like negative numbers to show in brackets.

    cell reference is A1

    I found the following code but I can't change it to allow for negative numbers:

    Sub Macro1()
    Dim fmat As String
    fmat = Range("A1").Value
    Selection.NumberFormat = Chr(34) & " " & fmat & Chr(34) & "#,##0"
    End Sub

    Thanks in advance

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: numberformat with cell reference for negative numbers

    selection.numberformat = "#,##0.00;(-#,##0.00)"

  3. #3
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: numberformat with cell reference for negative numbers

    You could try with:
    Please Login or Register  to view this content.
    Regars,
    Antonio

+ 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