+ Reply to Thread
Results 1 to 8 of 8

Trouble with .Formula

  1. #1
    Forum Contributor
    Join Date
    10-04-2004
    MS-Off Ver
    2013
    Posts
    148

    Trouble with .Formula

    Hi!

    I'm getting a little trouble inserting a simple formula through VBA

    CODE:
    Please Login or Register  to view this content.
    The formula is in portuguese but the basis is: if both cells H2 and G2 are numbers, then 1111, else 2222.

    I copied the formula straight from the sheet and pasted it in the VBA code as a string

    When I run it I get an "application-defined or object-defined error"

    Am I using the .Formula propertyincorrectly? How can I solve this?

    Thanks in advance!
    Last edited by pmguerra; 11-27-2008 at 10:59 AM.

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284
    Try this (trust me!)

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    10-04-2004
    MS-Off Ver
    2013
    Posts
    148
    Indeed I trust you...

    I had already translated the formula to plain english and got the same error. Tried it again and still no change...

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Replace the semi colons with commas
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Contributor
    Join Date
    10-04-2004
    MS-Off Ver
    2013
    Posts
    148
    Thanks!

    That worked, royUK.

    Still I find it pretty "annoying" that the formula doesn't work in portuguese...

    Thank you!

  6. #6
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284
    Quote Originally Posted by pmguerra View Post
    Thanks!

    That worked, royUK.

    Still I find it pretty "annoying" that the formula doesn't work in portuguese...

    Thank you!
    That is because VBA only understands English. The language extensions are in Excel, not VBA, it is just a layer and eveyrthing gets semi-compiled into a common denominator.

  7. #7
    Forum Contributor
    Join Date
    10-04-2004
    MS-Off Ver
    2013
    Posts
    148
    Yes, I can understand that.

    Still, I tried the "portuguese version" of the formula, by substituting the the ";" for "," and I didn't the run-time error I got before. Instead, in the worksheet, I got a #NAME error.

    When I performed a simple edit on the formula (F2 + Enter), it recognized it and it returned the value correctly...

    Try and explain that...

    Thank you for the help!!!

  8. #8
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284
    Quote Originally Posted by pmguerra View Post
    Yes, I can understand that.

    Still, I tried the "portuguese version" of the formula, by substituting the the ";" for "," and I didn't the run-time error I got before. Instead, in the worksheet, I got a #NAME error.

    When I performed a simple edit on the formula (F2 + Enter), it recognized it and it returned the value correctly...

    Try and explain that...

    Thank you for the help!!!
    I have never seen that. I knew your original problem, that is how I knew how to solve it, but it works thereon for me.

+ 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