Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine the type of currency in a cell
Hi!
I have an excel sheet where some cells are formated as Currency Euro others as Currency Brittish Pund and others as Currency American Dollars. I would now like, in Vba, to determine what type of currency a specific cell is containing. Is that possible? I'm looking for some thing like: Range(A1).CurrencyType=Euro Any suggestions are appreciated. Thanks Anders --- Message posted from http://www.ExcelForum.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine the type of currency in a cell
Anders, you can extract the first formatted character in a cell like this:
dim firstC as string firstC = left(ActiveCell.Text,1) You can then test this against the character for the currency. For example: if FirstC ="$" then I don't know the symbols for the Euro or British pound, but they shoud be easy to find. Bob Flanagan Macro Systems http://www.add-ins.com Productivity add-ins and downloadable books on VB macros for Excel "Anders " wrote in message ... Hi! I have an excel sheet where some cells are formated as Currency Euro others as Currency Brittish Pund and others as Currency American Dollars. I would now like, in Vba, to determine what type of currency a specific cell is containing. Is that possible? I'm looking for some thing like: Range(A1).CurrencyType=Euro Any suggestions are appreciated. Thanks Anders --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine the type of currency in a cell
On Sun, 11 Jan 2004 06:32:37 -0600, Anders
wrote: Hi! I have an excel sheet where some cells are formated as Currency Euro others as Currency Brittish Pund and others as Currency American Dollars. I would now like, in Vba, to determine what type of currency a specific cell is containing. Is that possible? I'm looking for some thing like: Range(A1).CurrencyType=Euro Any suggestions are appreciated. Thanks Anders It may depend on what you want to do with the data, but perhaps this will help: ================= Sub CurrencyFormat() Dim CurFmt As String CurFmt = Selection.NumberFormat If InStr(1, CurFmt, "£") Then CurFmt = "British Pound" If InStr(1, CurFmt, "€") Then CurFmt = "Euro" 'Note that non-USD formats may include the '$', so test for this last. If InStr(1, CurFmt, "$") Then CurFmt = "US Dollar" MsgBox ("Format of Cell " & Selection.Address & " is " & CurFmt) End Sub ========================== --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
I type in a number in a cell but it wont convert to currency help | Excel Worksheet Functions | |||
How to add new currency Symbol in Format/Cell/Currency | Excel Discussion (Misc queries) | |||
Default display format for "currency" data type | Excel Discussion (Misc queries) | |||
When I type numbers in currency all I get is ####### | Excel Discussion (Misc queries) | |||
Determine File Type | Excel Programming |