Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 53
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 296
Default Help combining formatting in macro functions

On 17 Aug 2006 16:43:19 -0700, "Slashman"
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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 53
Default 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"
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
__________________________


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 53
Default Help combining formatting in macro functions

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.

Slashman wrote:
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"
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining IF OR and AND functions andyp161 Excel Worksheet Functions 3 April 20th 06 06:05 PM
Macro not formatting correctly js8373 Excel Discussion (Misc queries) 0 February 28th 06 07:53 PM
Creating & Combining Macro to Functions Wanda H. Excel Worksheet Functions 1 August 15th 05 09:48 PM
Excel Macro Question about Conditional Formatting David Britton via OfficeKB.com New Users to Excel 3 February 10th 05 02:23 PM
How do I set a date range for conditional formatting in a macro? billo Excel Worksheet Functions 3 February 7th 05 06:19 PM


All times are GMT +1. The time now is 12:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"