Any help would be greatly appreciated.
Regards
Marcello
A lot depends on what exactly you meant by:
"The list is generated from a separate worksheet which contains the currency formatting in the cell
to the right."
Let's say that you have a list of currency format names in one column, and the format string as text
in the next (to the right). And let's say that you have three named ranges: one with the currency
values that need to be formatted (CurrVal), one with the format name and format strings (CurrFormat)
and a single cell with the dropdown (CurrFormSel)
Your macro could be as easy as:
Sub SetCurrFormat()
Range("CurrVal").NumberFormat = Application.Vlookup(Range("CurrFormSel").Value, _
Range("CurrFormat"),2,False)
End Sub
You could also fire this macro through the change event, so that when the value of CurrFormSel
changes, the formats are updated. Copy this code, and put it into the sheet's codemodule.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Name.Name <> "CurrFormSel" Then Exit Sub
SetCurrFormat
End Sub
HTH,
Bernie
MS Excel MVP
<myfocu...@googlemail.com> wrote in message
news:1178280450.2...@h2g2000hsg.googlegroups.com...
Thanks for the information. The code works well but I have hit upon a
couple of problems. When changing other cells on the worksheet the
change event gives an error, Run-time error '1004': Application-
defined or object-defined error.
Secondly the format strings contain letters that Excel seems to
interpret. For example the Algerian Dinar has the string DZD. Excel
changes the format of the cells to a date format. Is there any way
around this?
Thanks again.
Marcello