Consulting

Results 1 to 3 of 3

Thread: Problem inserting formula with VBA

  1. #1

    Problem inserting formula with VBA

    Good morning,

    I'm having some issues finishing a VBA code (I'm no expert).
    The debugger jumps on this line:

    Cells(n_fila_nueva, 19).Formula = "=IF(" & Cells(n_fila_nueva, 14).Address & "<1;'00" & Cells(n_fila_nueva, 3) & "'!$M$13;0)"

    The weird thing is that if I run the macro without the equals, like:

    Cells(n_fila_nueva, 19).Formula = "IF(" & Cells(n_fila_nueva, 14).Address & "<1;'00" & Cells(n_fila_nueva, 3) & "'!$M$13;0)"

    And then I add equals to the cell where I'm putting the formula, evetything works fine.


    I'm probably making a silly mistake, so if any of the experienced users can give me hand would be much appreciated.

    Thanks in advance.

  2. #2
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    You need to use commas not semicolons when using the Formula property:

    Cells(n_fila_nueva, 19).Formula = "=IF(" & Cells(n_fila_nueva, 14).Address & "<1,'00" & Cells(n_fila_nueva, 3) & "'!$M$13,0)"
    Be as you wish to seem

  3. #3
    Works fine now, thank you so much.
    Didn't expect it to be so silly.

Tags for this Thread

Posting Permissions

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