Using validation list to control currency cell formatting

Nyanko

Active Member
Joined
Sep 1, 2005
Messages
437
I'm trying to find a way to influence the formatting of a cell based on a the value of another cell.

Let me explain :)

In cell A1 I have a drop down list of currency names : GBP, USD, EUR etc.....

Is there a way to use this selection to control the formatting of amounts entered elsewhere on the sheet ? So that if someone has selected USD then cell B1 is formatted 7.00USD but if the drop down is changed to GBP then it becomes 7.00GBP

If there is a way to actually use the symbols ($,£, €) then I will be even more impressed :D
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Stick the following in the worksheet onject:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$1" Then
        Select Case Range("A1")
            Case "GBP"
                Range("B1").NumberFormat = "[$£-809]#,##0.00"
            Case "USD"
                Range("B1").NumberFormat = "[$$-409]#,##0.00"
            Case "EUR"
                Range("B1").NumberFormat = "[$€-2] #,##0.00"
            Case Else
                Range("B1").NumberFormat = "#,##0.00"
        End Select
    End If
End Sub
 
Upvote 0
Add the code below to the macro object of you sheet.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
        Target.NumberFormat = "#,##0.00_-[$" & Range("B1") & "]"
    End If

End Sub

Range A1:A10 is the range where numbers will be formatted when they change.
In Range B1 you enter what currency you want in the format, i.e. USD.
 
Upvote 0

Forum statistics

Threads
1,224,524
Messages
6,179,308
Members
452,904
Latest member
CodeMasterX

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