+ Reply to Thread
Results 1 to 7 of 7

How do I tell (through VBA) if users region is going to use a dot or comma for money?

  1. #1
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    462

    How do I tell (through VBA) if users region is going to use a dot or comma for money?

    Hi, I have a macro that has always worked perfectly. It copies data from a CSV file (lets say a particular column has the value 40.00 in it) and my excel is happy with it and can do calculations.

    I have a colleague in the Netherlands who I've just shared this with and when it imports the data, it just cannot understand what 40.00 is. If I manually change this to 40,00 (European comma format) then it's happy days.

    My question is - how do I ask VBA.. "If my user is English then keep the dot. If he is Dutch then replace the dot with a comma"

    I can do the replace part but I don't know how to check if it actually needs replacing? thanks, John

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: How do I tell (through VBA) if users region is going to use a dot or comma for money?

    See if this helps: https://docs.microsoft.com/en-us/pre...ectedfrom=MSDN

    There's an example right at the bottom that, I think, gives you what you want.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: How do I tell (through VBA) if users region is going to use a dot or comma for money?

    Thinking about it, you could probably test if the (supposedly numeric) cell is seen a Text. So 40.00 would be seen as text in the Netherlands and numeric in the UK.

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    462

    Re: How do I tell (through VBA) if users region is going to use a dot or comma for money?

    Excellent, I'll try that when I'm back in the office tomorrow. Looks like it would do the trick. Thank you

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: How do I tell (through VBA) if users region is going to use a dot or comma for money?

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  6. #6
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    462

    Re: How do I tell (through VBA) if users region is going to use a dot or comma for money?

    yes that definitely, worked thank you!

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: How do I tell (through VBA) if users region is going to use a dot or comma for money?

    You're welcome. Thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 05-25-2020, 01:12 AM
  2. [SOLVED] Allow users to enter each data separated by Special character comma(,)
    By mchilapur in forum Excel General
    Replies: 2
    Last Post: 08-04-2018, 10:03 AM
  3. Replies: 2
    Last Post: 06-01-2015, 06:23 PM
  4. Find and remove all text to the left of last comma (including comma) in a cell
    By Excelrookie_1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-05-2013, 08:47 AM
  5. [SOLVED] If comma present, then place a character before and after comma (FORMULA)
    By jaimealvarez in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-21-2012, 04:04 PM
  6. Replies: 4
    Last Post: 05-17-2012, 06:30 PM
  7. Replies: 1
    Last Post: 10-04-2007, 12:04 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1