currency formatting of cells with code

H

Harold Good

Hi, below is the code I have so users from different countries can enter
their currency symbol. e.g $ or £ or ? or "Ksh" (Kenya Shillings), Bht
(Thai Baht), etc.

By them entering their currency symbol (or letter code) into cell M2
(Cells(2, 13)), the Change event fires and it formats a Range
(OtherCurrencyCells), with this format.

It works quite well, but when I try to enter certain letters into M2,
nothing happens. For about 1/3 of letters it will fire, but won't change the
format. E.g. It accepts all the currency symbols I've tried so far, but
when I try to enter "ksh", or "bht", it won't change. But it will change for
"kqr" and some other single and multiletter combinations. I have no idea the
reason or the pattern. It will change for "k", but if I enter "ksh", it only
takes the "k" as the currency format. But if I put any of these
unacceptable ones inside "quotes", it takes them all.

So I guess that could be my solution, to have users enter letter codes for
their currency format, e.g. Ksh, Bht, in double quotes.

But now I'm just plain curious as to why it won't accept certain of these
letters. Any ideas? Thanks, Harold




Private Sub Worksheet_Change(ByVal Target As Range)

Set t = Target
On Error GoTo ErrHandler:
If Intersect(t, Range("A1:z115")) Is Nothing Then Exit Sub
Range("OtherCurrencyCells").NumberFormat = Cells(2, 13).Value & "* #,##0"
Exit Sub
ErrHandler:
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top