Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 49948

Formula pasted works. Same formula in VBA doesn't???

$
0
0
Well... the formula below works fine when I paste it into a cell (F2).

Code:

=IF(OR(G4=":15",G4=":10"),IF(F4<$N$1,"Yes",IF(COUNTIFS('L:\Sports Packages\[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'!$A$7:$A$49,I4,'L:\Sports Packages\[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'!$D$7:$D$49,"<="&J4,'L:\Sports Packages\[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'!$E$7:$E$49,">="&J4,'L:\Sports Packages\[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'!$I$7:$I$49,"<="&(K4/0.5))>0,"Yes","No")),IF(F4<$N$1,"Yes",IF(COUNTIFS('L:\Sports Packages\[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'!$A$7:$A$49,I4,'L:\Sports Packages\[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'!$D$7:$D$49,"<="&J4,'L:\Sports Packages\[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'!$E$7:$E$49,">="&J4,'L:\Sports Packages\[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'!$I$7:$I$49,"<="&K4)>0,"Yes","No")))

However, when inputting the same formula in a macro, I get a debug error when running....

Code:

    ActiveCell.FormulaR1C1 = _
        "=IF(OR(RC[-7]="":15"",RC[-7]="":10""),IF(RC[-8]<R1C14,""Yes"",IF(COUNTIFS('[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'!R7C1:R49C1,RC[-5],'[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'!R7C4:R49C4,""<=""&RC[-4],'[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'!R7C5:R49C5,"">=""&RC[-4],'[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'!R7" & _
        ",""<=""&(RC[-3]/0.5))>0,""Yes"",""No"")),IF(RC[-8]<R1C14,""Yes"",IF(COUNTIFS('[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'!R7C1:R49C1,RC[-5],'[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'!R7C4:R49C4,""<=""&RC[-4],'[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'!R7C5:R49C5,"">=""&RC[-4],'[Shoot For Loot  Minimum Rates 2014 Games.xlsx]Sheet1'" & _
        "C9,""<=""&RC[-3])>0,""Yes"",""No"")))"


Any thoughts, helpful insights appreciated. Thank you!

Viewing all articles
Browse latest Browse all 49948

Trending Articles