|
|
Conditional number format of cell |
|
Author |
Message |
FE
|
Posted: Mon Oct 27 10:27:03 CST 2003 |
Top |
Excel Programming >> 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
Excel235
|
|
|
|
|
Tom
|
Posted: Mon Oct 27 10:27:03 CST 2003 |
Top |
Excel Programming >> 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
> 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
|
|
|
|
|
Don
|
Posted: Mon Oct 27 10:28:50 CST 2003 |
Top |
Excel Programming >> 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
> 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
|
|
|
|
|
|
|