Cell format

Colleen45

Active Member
Joined
Jul 22, 2007
Messages
495
Is it possible to change the format of a cell from currency to percentage based on another cells value (1 or 2)?
 
I'm quite sure there is no code attached. It is not a command button, but a Form Control Option button, I would prefer if this be done in code. When I right click, there are very few properties. Colour, size, linkcell etc
 
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
There is no code attached to option button, it is a form option button (not Active X), when you right click for properties, there are a very limited amount of properties that can be changed. I would be happier if this could be done in code!
 
Upvote 0
Ah that makes sense - insert the following code into a standard module (not a worksheet or ThisWorkbook module):

Code:
Sub Font_Change()
Select Case Range("AU5").Value
    Case 1
        Range("E13:W13").NumberFormat = "$#,##0.00"
    Case 2
        Range("E13:W13").NumberFormat = "0.00%"
    Case Else
        'currently nothing here - so values other than 1 or 2 do not change the existing format
End Select
End Sub

Next, right-click on one of these option buttons and select Assign macro - assign the Font_Change macro to it and it should now work as intended.
 
Upvote 0
Thank you, that seemed to have worked, although I did assign the macro to both option buttons, as it seemed to stop after running once, thank you for all your time and effort in helping me with this.
 
Upvote 0

Forum statistics

Threads
1,215,232
Messages
6,123,763
Members
449,120
Latest member
Aa2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top