VBA - Change Existing Currency Formatted Cells On Multiple Sheets Based On Value Of 1 Cell On One Worksheet

lalahaha

New Member
Joined
Jan 3, 2019
Messages
3
Hello there, I am a newbie VBA user here. By default, the 'Currency' cells of the entire workbook are formatted in 2 version (difference is just in decimal point, as per below): .NumberFormat = "$#,##0.00" .NumberFormat = "$#,##0"What I am trying to do is, when the case of 1 cell on the main worksheet (component A) changes, all cells formatted as default currency (as per above) on all worksheets will change based on the case parameters below: Select Case Target.Value Case "" .NumberFormat = "#,##0" Case "MYR" .NumberFormat = """RM""#,##0" Case "SGD" .NumberFormat = "$#,##0" Case "THB" .NumberFormat = ChrW(&HE3F) & "#,##0" Case "PHP" .NumberFormat = ChrW(8369) & "#,##0" Case "VND" .NumberFormat = ChrW(8363) & "#,##0" Case "IDR" .NumberFormat = """Rp""#,##0" Case "USD" .NumberFormat = "$#,##0" Case "EUR" .NumberFormat = "€#,##0" I am stuck at the following: 1. Getting VBA to select all cells that are formatted as the default 2 currency versions on all worksheets. 2. Depending (component A), all existing currency formatted cells will change as per above case. 3. Other cells on all worksheets that are not formatted as currency will not be affected. Let me know if this is unclear. Much appreciated, thank you. Best regards, lalahaha
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hello there,

I am a newbie VBA user here.

By default, the 'Currency' cells of the entire workbook are formatted in 2 version (difference is just in decimal point, as per below):
.NumberFormat = "$#,##0.00"
.NumberFormat = "$#,##0"

What I am trying to do is, when the case of 1 cell on the main worksheet (component A) changes, all cells formatted as default currency (as per above) on all worksheets will change based on the case parameters below:

Select Case Target.Value
Case ""
NumberFormat = "#,##0"
Case "MYR"
.NumberFormat = """RM""#,##0"
Case "SGD"
.NumberFormat = "$#,##0"
Case "THB"
.NumberFormat = ChrW(&HE3F) & "#,##0"
Case "PHP"
.NumberFormat = ChrW(8369) & "#,##0"
Case "VND"
.NumberFormat = ChrW(8363) & "#,##0"
Case "IDR"
.NumberFormat = """Rp""#,##0"
Case "USD"
.NumberFormat = "$#,##0"
Case "EUR"
.NumberFormat = "€#,##0"

I am stuck at the following:
1. Getting VBA to select all cells that are formatted as the default 2 currency versions on all worksheets.
2. Depending (component A), all existing currency formatted cells will change as per above case.
3. Other cells on all worksheets that are not formatted as currency will not be affected.

Let me know if this is unclear.

Much appreciated, thank you.

Best regards,
lalahaha

 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,312
Members
452,634
Latest member
cpostell

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