+ Reply to Thread
Results 1 to 3 of 3

Help combining formatting in macro functions

  1. #1
    Slashman
    Guest

    Help combining formatting in macro functions

    Hi,

    Frank helped me with the second part of my problem but I have now
    realised that the two formatting lines in the macro below override one
    another rather than work in sucession.

    Range("aa12").NumberFormat = _
    Range("d10").NumberFormat & 0

    (Sets the number format in DP in cell aa12 to d10 plus one more DP).

    'Range("AA12").Select
    'Selection.NumberFormat = "+#0.##0;-#0.##0"

    (Sets either a prefix of + for pos numbers or - for neg numbers).

    When I run the macro it sets the DP correctly at one extra than the DP
    in d10, but then goes to a general format losing the DP but with the
    prefixes.

    I need them to both work together.

    Is there another way to achieve this?

    Thanks for help in advance,

    Aaron.


  2. #2
    Richard Buttrey
    Guest

    Re: Help combining formatting in macro functions

    On 17 Aug 2006 16:43:19 -0700, "Slashman" <[email protected]>
    wrote:

    >Hi,
    >
    >Frank helped me with the second part of my problem but I have now
    >realised that the two formatting lines in the macro below override one
    >another rather than work in sucession.
    >
    >Range("aa12").NumberFormat = _
    >Range("d10").NumberFormat & 0
    >
    >(Sets the number format in DP in cell aa12 to d10 plus one more DP).
    >
    >'Range("AA12").Select
    >'Selection.NumberFormat = "+#0.##0;-#0.##0"
    >
    >(Sets either a prefix of + for pos numbers or - for neg numbers).
    >
    >When I run the macro it sets the DP correctly at one extra than the DP
    >in d10, but then goes to a general format losing the DP but with the
    >prefixes.
    >
    >I need them to both work together.
    >


    If I understand the problem correctly, and this is untested, but try
    changing that format line to

    Selection.NumberFormat = "+#0.##0.0;-#0.##0.0"

    I notice that there's a single inverted comma in your posting for this
    line. Was this a typo because it suggests it's commented out.

    HTH

    >Is there another way to achieve this?
    >
    >Thanks for help in advance,
    >
    >Aaron.


    __
    Richard Buttrey
    Grappenhall, Cheshire, UK
    __________________________

  3. #3
    Slashman
    Guest

    Re: Help combining formatting in macro functions

    Hi,

    Yes I commented it out till I find a fix for it.

    I tried it but it doesent work. The importance of the two separate
    formatting actions on the cell in question is because the first action
    looks at a ref cell and makes the cell have one more DP. The next
    action does the + or - prefixing.

    Cheers,

    Aaron.

    Richard Buttrey wrote:

    > On 17 Aug 2006 16:43:19 -0700, "Slashman" <[email protected]>
    > wrote:
    >
    > >Hi,
    > >
    > >Frank helped me with the second part of my problem but I have now
    > >realised that the two formatting lines in the macro below override one
    > >another rather than work in sucession.
    > >
    > >Range("aa12").NumberFormat = _
    > >Range("d10").NumberFormat & 0
    > >
    > >(Sets the number format in DP in cell aa12 to d10 plus one more DP).
    > >
    > >'Range("AA12").Select
    > >'Selection.NumberFormat = "+#0.##0;-#0.##0"
    > >
    > >(Sets either a prefix of + for pos numbers or - for neg numbers).
    > >
    > >When I run the macro it sets the DP correctly at one extra than the DP
    > >in d10, but then goes to a general format losing the DP but with the
    > >prefixes.
    > >
    > >I need them to both work together.
    > >

    >
    > If I understand the problem correctly, and this is untested, but try
    > changing that format line to
    >
    > Selection.NumberFormat = "+#0.##0.0;-#0.##0.0"
    >
    > I notice that there's a single inverted comma in your posting for this
    > line. Was this a typo because it suggests it's commented out.
    >
    > HTH
    >
    > >Is there another way to achieve this?
    > >
    > >Thanks for help in advance,
    > >
    > >Aaron.

    >
    > __
    > Richard Buttrey
    > Grappenhall, Cheshire, UK
    > __________________________



+ 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