0

I'm trying run the following line in a VBA script:

Sheets("sheet1").Range("C13").formula = "=IF(ISERROR(GETPIVOTDATA(""Beloeb"";LikviditetEgenkapitalPivot!$A$3;""Dato"";$B2022;""Dimm4"";C$11))=TRUE;0;(GETPIVOTDATA(""Beloeb"";LikviditetEgenkapitalPivot!$A$6;""Dato"";$B2022;""Dimm4"";C$11)))"

I'm getting an "Application-defined or object-defined error"

I've been looking at the similar questions below (and followed the guide) - but I'm still in "dead water"

I've also tried to use the "chr(34)" method.

Any suggestions?

Inserting double quotes string within formula within VBA (Excel

VBA Application Defined or Object-Defined Error with Formula

Raymond Wu
  • 3,357
  • 2
  • 7
  • 20
schris
  • 1
  • 1
  • Looks OK, except I think you need to use commas (`,`) instead of semicolons (`;`) in VBA, no matter what your international list spearator – VBasic2008 Jan 12 '22 at 12:38
  • Asked 1000nd times: You need to specify the formula in *english* format, replace the semicolon by comma. And I will never understand why such complex things are not written into a variable so that you can check the content with the debugger. – FunThomas Jan 12 '22 at 12:38
  • 3
    You can reduce complexity of the formula by using `IFERROR` instead of `IF(ISERROR ...`. Tipp: to avoid the semicolon/comma-issue: write the formula to a cell, select that cell. Then in VBA editor in the immediate window type `?selection.formula` and you will get as a result the correct version for VBA – Ike Jan 12 '22 at 12:41

0 Answers0