+ Reply to Thread
Results 1 to 9 of 9

ActiveCell.FormulaR1C1 Regional Setting influence?

  1. #1
    Registered User
    Join Date
    07-15-2008
    Location
    germany
    Posts
    56

    ActiveCell.FormulaR1C1 Regional Setting influence?

    HI Friends,

    I wonder, whether ActiveCell.FormulaR1C1 has depends on regional setting of PC. My PC language is english and the following statement works fine
    PHP Code: 
    ActiveCell.FormulaR1C1 "=" ActiveCell.Value " - " currentvalue "" 
    and one of my friend has german language for the Pc and the same statement throughs an error.
    What could be reason behind this?
    I appreciate your advises.
    Thanks

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: ActiveCell.FormulaR1C1 Regional Setting influence?

    Very hard to say without knowing what the value of the Activecell and the variable currentvalue is at the time of the error.
    Richard Schollar
    Microsoft MVP - Excel

  3. #3
    Registered User
    Join Date
    07-15-2008
    Location
    germany
    Posts
    56

    Re: ActiveCell.FormulaR1C1 Regional Setting influence?

    I have found that for the two variable values like 8 and 4 the code works, but for values like 9,88 and 7,22 the code does not work. On the other side for values 9.88 and 7.22 the code works fine.
    The question arrises How can I update my code that it should work for PCs with different settings.

  4. #4
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: ActiveCell.FormulaR1C1 Regional Setting influence?

    That's because of the system separators. Try using the FormulaR1C1Local property instead:

    Please Login or Register  to view this content.
    Richard

  5. #5
    Registered User
    Join Date
    07-15-2008
    Location
    germany
    Posts
    56

    Re: ActiveCell.FormulaR1C1 Regional Setting influence?

    Quote Originally Posted by RichardSchollar View Post
    That's because of the system separators. Try using the FormulaR1C1Local property instead:

    Please Login or Register  to view this content.
    Richard
    Sorry for late response
    I tried with your suggestion for 9,88 and 7,22 and the result for subtraction is 266. I think it does not work in this way.

  6. #6
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: ActiveCell.FormulaR1C1 Regional Setting influence?

    so what did it do using FormulaR1C1Local? Did you get an error return from the formula? Did VBA debug at that line and if so what was the error code?

  7. #7
    Registered User
    Join Date
    07-15-2008
    Location
    germany
    Posts
    56

    Re: ActiveCell.FormulaR1C1 Regional Setting influence?

    Quote Originally Posted by RichardSchollar View Post
    so what did it do using FormulaR1C1Local? Did you get an error return from the formula? Did VBA debug at that line and if so what was the error code?
    there is no error thrown by the compiler but the subtraction of two values give me result as 266, which is wrong, right would be 9,88 - 7,22 = 2,66.

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,280

    Re: ActiveCell.FormulaR1C1 Regional Setting influence?

    How is currentvalue declared and assigned a value?
    Remember what the dormouse said
    Feed your head

  9. #9
    Registered User
    Join Date
    07-15-2008
    Location
    germany
    Posts
    56

    Re: ActiveCell.FormulaR1C1 Regional Setting influence?

    I found the solution without changing anything in the system settings

    PHP Code: 
    If Application.DecimalSeparator "," Then

    ActiveSheet
    .UsedRange.Select

    Application
    .DecimalSeparator "."
    Application.ThousandsSeparator ","
    Application.UseSystemSeparators False

    ElseIf Application.DecimalSeparator "," And Application.ThousandsSeparator "," Then




    End 
    If 
    Thanks for your support

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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