Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<== change to suit
On Error GoTo ws_exit
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Select Case .Offset(0, -1).Value
Case "GBP": .NumberFormat = "£#,##0.00;(£#,##0.00)"
Case "USD": .NumberFormat = "\$#,##0.00;(\$#,##0.00)"
Case "EUR": .NumberFormat = "#,##0.00?;(#,##0.00?)"
End Select
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
--
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
"Summerstone" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi all,
>
> I have a quotation tool where cell C13 can be "GBP", "USD" or "EUR", a
> data validation where the user can choose the currency.
>
> I'd like the figures in the spreadsheet to have their currency format
> dependant on that cell.
>
> Conditional formatting isn't an option, this only allows basic
> formatting, not currency.
>
> I've tried looking at a selection change event in VBA but with my
> limited experience it going nowhere.
>
> Any suggestions would be much appreciated!!
>
> Many thanks,
> Tony Summers
>
|