#name? error after run macros

  • Hi, when I run the macro, it should give me a percentage on the cell b2, but instead, I'm receiving an #name? error that can be fixed just clicking in the code on excel and pressing enter and the formula still the same, why it doesn't start to run the percentage automatic and how it can be fixed?


    here is my code


  • Your formula string needs to be in English in the code:


    Code
    1. Range("B2").Formula = "=COUNTIF(B4:B" & UltimoAssociado & ",""P"") / (COUNTIF(B4:B" & UltimoAssociado & ",""P"") + (COUNTIF(B4:B" & UltimoAssociado & ",""F"")))"

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Your formula string needs to be in English in the code:


    Code
    1. Range("B2").Formula = "=COUNTIF(B4:B" & UltimoAssociado & ",""P"") / (COUNTIF(B4:B" & UltimoAssociado & ",""P"") + (COUNTIF(B4:B" & UltimoAssociado & ",""F"")))"

    Thank you so much, I was stuck on this for 2 days, hahah

  • fallsxr


    Welcome toOzgrid. Please take a few minutes to read the Forum Rules to learn how to use the forum correctly, I have added code tags to your post this time.

    I'll read and be more careful next time, thanks roy