Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Recognize currency in a cell
Hi,
I have a spreadsheet which uses different currencies when data are imported. I'm looking for a method to recognize currency type used in a cell, for example: A1: €100 or $100, £100 and so on. Many thanks. Marcin |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Recognize currency in a cell
On Dec 2, 5:40*pm, Marcin P wrote:
Hi, I have a spreadsheet which uses different currencies when data are imported. I'm looking for a method to recognize currency type used in a cell, for example: A1: €100 or $100, £100 and so on. Many thanks. Marcin hi currency type is formating so that is what you would be looking for. here is a do nothing sniplet that checks for dollars US. Sub checkformat() If Range("B2").NumberFormat = "$#,##0.00" Then MsgBox "Dollars" Else MsgBox "NOT Dollars" End If End Sub you would need to find out what your other currency formats are and check for each one perhaps in a loop or something. Regards FSt1 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Recognize currency in a cell
hmm..
formating can vary a lot.. there is a better way Typename Sub testttt4() Dim c As Range ' Set c = ActiveSheet.[A1] For Each c In ActiveSheet.UsedRange If TypeName(c.Value) = "Currency" Then c.Select MsgBox " selected cell is a currency cell" exit sub End If Next c End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Recognize currency in a cell
On Dec 3, 3:48*am, minimaster
wrote: hmm.. formating can vary a lot.. there is a better way * *Typename Sub testttt4() * * Dim c As Range ' * *Set c = ActiveSheet.[A1] * * For Each c In ActiveSheet.UsedRange * * * * If TypeName(c.Value) = "Currency" Then * * * * * * c.Select * * * * * * MsgBox " selected cell is a currency cell" * * * * * * exit sub * * * * End If * * Next c End Sub hi, i took it that he was looking for different currency types not just currency. Perhaps the op will clarify for us. Regards FSt1 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Recognize currency in a cell
I'm not sure about this.
How should Excel know the currency format for each cell of data imported? If raw numbers, no format would be displayed. If the data OP is grabbing comes in with different currency types displayed, I would say the data is in Text form. Maybe OP should be looking at LEFT and CODE functions?? =CODE(LEFT,A1) would return 163 for English Pound £ 128 for Euro sign € Of course OP would have to have a table with codes for all currency types involved. Easy enough to build one if that's the case. Gord Dibben MS Excel MVP On Fri, 3 Dec 2010 16:29:05 -0800 (PST), FSt1 wrote: On Dec 3, 3:48*am, minimaster wrote: hmm.. formating can vary a lot.. there is a better way * *Typename Sub testttt4() * * Dim c As Range ' * *Set c = ActiveSheet.[A1] * * For Each c In ActiveSheet.UsedRange * * * * If TypeName(c.Value) = "Currency" Then * * * * * * c.Select * * * * * * MsgBox " selected cell is a currency cell" * * * * * * exit sub * * * * End If * * Next c End Sub hi, i took it that he was looking for different currency types not just currency. Perhaps the op will clarify for us. Regards FSt1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Recognize Cell Color and Sum Data accordingly | Excel Discussion (Misc queries) | |||
How to add new currency Symbol in Format/Cell/Currency | Excel Discussion (Misc queries) | |||
Formula to recognize text only in a cell | Excel Worksheet Functions | |||
recognize the cell | Excel Discussion (Misc queries) | |||
how do i automatically format a cell to only recognize the first w | Excel Discussion (Misc queries) |