Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / August 2006

Tip: Looking for answers? Try searching our database.

Help combining formatting in macro functions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Slashman - 18 Aug 2006 00:43 GMT
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.
Richard Buttrey - 18 Aug 2006 12:05 GMT
>Hi,
>
[quoted text clipped - 17 lines]
>
>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
__________________________
Slashman - 18 Aug 2006 12:34 GMT
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.

> >Hi,
> >
[quoted text clipped - 38 lines]
> Grappenhall, Cheshire, UK
> __________________________
Slashman - 25 Aug 2006 04:41 GMT
Here is another way of explaining it,

Because the number DP changes each time I use the spreadsheet, I cant
just have it formatted for custom all the time for the + and - prefix,
as when I run my macro to set the DP of that cell, it overrides the
custom formatting for the + or -.

I need both things to happen, is it possible or is there another way to
simultaneously change the DP of the cell and apply the custom number
format for + and - numbers?

Cheers,

Aaron.

> Hi,
>
[quoted text clipped - 51 lines]
> > Grappenhall, Cheshire, UK
> > __________________________
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.