+ Reply to Thread
Results 1 to 5 of 5

Run Time Error 13 (Type mismatch) due to different regional settings

  1. #1
    Registered User
    Join Date
    09-14-2011
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    65

    Run Time Error 13 (Type mismatch) due to different regional settings

    Hi,

    I am in the UK and I write reports for colleagues in other offices around the world. I wrote this code with a simple do while loop whic adds a calculation to the end of each row where the first cell is not blank. The calculation is:

    PHP Code: 
    ActiveCell.Offset(010) * ActiveCell.Offset(09
    Simple, right?... no! With my English regional settings it would show the calculation as this:

    PHP Code: 
    .0764000000000000 1,000 
    and that works fine for me and my US colleagues but not for my friends in France, because theirs would be
    PHP Code: 
    ,0764000000000000 1.000 
    even if not for the , at the start of the first number, it would multiply by 1 instead of 1,000 so would give completely the wrong answer!

    Obviously I can't expect all of my French colleagues to change their regional settings just so that they can run this report, so how can I fix this issue?

    Thanks,

    Soph

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Run Time Error 13 (Type mismatch) due to different regional settings

    Use the international settings to determine the decimals, list separators etc.


    Some links I can suggest you to check-out.

    https://msdn.microsoft.com/en-us/lib.../ff840213.aspx
    http://www.rondebruin.nl/win/s9/win012.htm

    I've run into similar issues the other way around, Dutch to US settings
    Hope this puts you on the right track
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Lightbulb Re: Run Time Error 13 (Type mismatch) due to different regional settings


    Hi !

    Whatever the decimal separator :

    PHP Code: 
    ActiveCell.Offset(010).Value ActiveCell.Offset(09).Value 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  4. #4
    Registered User
    Join Date
    09-14-2011
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    65

    Re: Run Time Error 13 (Type mismatch) due to different regional settings

    OK, thanks for your replies. The latest problem I have is that because the rate I am trying to multiply by is a text field in an OLAP cube, it is always shown as
    .0764000000000000. So I added:

    PHP Code: 
            If Application.International(xlDecimalSeparator) = "," Then
                    Rate 
    "0" Replace(ActiveCell.Offset(09), "."",")
                Else
                    
    Rate ActiveCell.Offset(09)
            
    End If 
    When I run the code (I changed my regional setting to French to test), the calculation doesn't work and just returns zeros for everything! I think this is because the first bit makes the rate a text string but I can't work out how to change it to number. I tried Rate.NumberFormat = "General" but I got invalid qualifier error, how do I do it or is there a beter way than what I've done?

    Thanks again

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Run Time Error 13 (Type mismatch) due to different regional settings

    The moment a file is opened in another regional setting it adapts.
    You could use
    Please Login or Register  to view this content.
    Since I have no idea how it works and what you're doing this just a guess, but it works with the files I send around to colleagues in the US, South America, the UK and the Netherlands

+ 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. [SOLVED] Run-time error '13': Type mismatch
    By Aeneren in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-26-2014, 01:52 PM
  2. [SOLVED] Run time error 13 type mismatch
    By potga in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-23-2014, 11:33 PM
  3. [SOLVED] Run time error 13 - Type mismatch
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2013, 08:30 AM
  4. [SOLVED] Run-time error '13': Type mismatch
    By smonzon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-19-2013, 12:42 AM
  5. Run-Time Error 13, Type Mismatch
    By Jbm444 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-11-2010, 12:10 PM
  6. Run time error - type mismatch
    By justinng in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-10-2009, 11:24 PM
  7. Run-time error '13'. Type mismatch
    By marse in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-13-2008, 11:49 AM

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