Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Conditional number format of cell

I want to conditionally change the number format of a cell. For example, if cell A1 = '%' , I want the format of the number in cell A2 to have a percentage format or if A1 = '$' I want the number in cell A2 to have a currency format. I understand how to use conditional formatting but I don't see how to change the number format, just the font, border or pattern.

Thanks in advance.

Brad
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Conditional number format of cell

Those are the options. You would need a macro to do this.

Changing the format, however, does not trigger an event, so you would
probably need the selectionchange event.

Just check the numberformat property and make the appropriate change.

--
Regards,
Tom Ogilvy

"bsteg" wrote in message
...
I want to conditionally change the number format of a cell. For example,

if cell A1 = '%' , I want the format of the number in cell A2 to have a
percentage format or if A1 = '$' I want the number in cell A2 to have a
currency format. I understand how to use conditional formatting but I don't
see how to change the number format, just the font, border or pattern.

Thanks in advance.

Brad



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Conditional number format of cell

try

Sub copystyle()
If Range("j7").Style = "Percent" Then _
Range("k7").Style = "Percent"
If Range("j8").Style = "Currency" Then _
Range("k8").Style = "Currency"
End Sub

"bsteg" wrote in message
...
I want to conditionally change the number format of a cell. For example,

if cell A1 = '%' , I want the format of the number in cell A2 to have a
percentage format or if A1 = '$' I want the number in cell A2 to have a
currency format. I understand how to use conditional formatting but I don't
see how to change the number format, just the font, border or pattern.

Thanks in advance.

Brad



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
Conditional formatting of number format? simonc Excel Discussion (Misc queries) 2 September 25th 09 10:00 AM
Conditional Formatting - Number Format AdmiralAJ Excel Worksheet Functions 8 March 18th 09 09:13 PM
conditional number format dependent on other cell Harold Good Excel Discussion (Misc queries) 2 April 25th 08 03:41 PM
How to create a conditional format that changes the number format tmbo Excel Discussion (Misc queries) 1 August 23rd 06 06:20 AM
Conditional format of minimum number MaggieMagill Excel Worksheet Functions 6 September 25th 05 11:36 PM


All times are GMT +1. The time now is 10:06 PM.

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

About Us

"It's about Microsoft Excel"