Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I type in a number in a cell but it wont convert to currency help Out in VA Excel Worksheet Functions 2 May 28th 10 12:04 AM
How to add new currency Symbol in Format/Cell/Currency NOORZAD Excel Discussion (Misc queries) 2 June 22nd 09 07:59 AM
Default display format for "currency" data type Cynthia Excel Discussion (Misc queries) 1 June 29th 07 01:12 PM
When I type numbers in currency all I get is ####### mommy4shane Excel Discussion (Misc queries) 3 December 3rd 05 07:33 AM
Determine File Type Brent[_5_] Excel Programming 2 January 6th 04 06:43 AM


All times are GMT +1. The time now is 10:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"