Results 1 to 12 of 12

Thread: parenthesys VBA

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    18

    Resolved parenthesys VBA

    Hi,

    I just wanted to know how to write '=CoorY(posx;2)' into a cell from a macro VBA.

    Thank you
    Last edited by macarena; Mar 16th, 2010 at 06:28 AM.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: parenthesys VBA

    Thread moved from 'VB.Net' forum to 'Office Development/VBA' forum.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: parenthesys VBA

    Code:
    Worksheets("Sheet1").Range("A18").Formula = "=CoorY(posx;2)"
    This, of course, is presuming your forumla is correct and error free.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    18

    Re: parenthesys VBA

    I've a problem with that: Error 1004.

    Actually I cannot enter the parenthesys in the sequence.

    Thank you

  5. #5
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: parenthesys VBA

    Show me the code for CoorY(). What is the semicolon for?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    18

    Re: parenthesys VBA

    I don't think that the code doesn't matter since I tried to do it with any other function and it didn't work either. For exemple:

    Code:
    Sheets("Calculs").Range("K83").Formula = "=SOMME(4;5)"
    The thing is that I can write until the parenthesis, like :

    Code:
    Sheets("Calculs").Range("K83").Formula = "=SOMME"
    But then if I write:

    Code:
    Sheets("Calculs").Range("K83").Formula = "=SOMME("
    I get the error so I think that there is a special way to write it but I don't find it.

    Thank you
    Last edited by macarena; Mar 16th, 2010 at 05:47 AM.

  7. #7
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: parenthesys VBA

    you need to show the full function, including the header line
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  8. #8
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: parenthesys VBA

    Have you mixed-up US-version and France-version of Excel?
    France: "=SOMME(4; 5)"
    US: "=SUM(4, 5)"
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  9. #9
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: parenthesys VBA

    you could try like
    Range("a3").Formula = "=somme(4,5)"
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    18

    Re: parenthesys VBA

    ok,

    I've just seen what I was doing wrong:

    My version is in french and even if in excel you write '=somme(4;5)' directly into the cell, when you want to do it from VBA you have to write :

    Code:
    Sheets("Sheet1").range("A1").formula="=SUM(4,6)"
    So, there are two important things:

    -The name of the function in VBA is always in english
    -The semicolon in excel is ',' in VBA

    Thank you everybody

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    18

    Re: parenthesys VBA

    I hadn't seen your answers in my last reply, if I had knew I wouldn't have written the same thing again!!!

    But yes, it was that, thank you

  12. #12
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: parenthesys VBA

    you can look at using formulalocal to insert formulas in your local language
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

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



Click Here to Expand Forum to Full Width