0
votes

Using Excel 2016 I am struggling to get a formula pasted into a cell with VBA (where the VBA does a data import). I have two sheets: Rapport SNN and Data.

Sheets("Rapport SNN").[E4].Formula = "=SUMIFS(Data!S2:Data!S2000;Data!V2:Data!V2000;""BankAxept"";Data!M2:Data!M2000;C4)/100"

Just throws me a:

Run-time error '1004': Application-defined or object-defined error.

What do I do wrong?

1
use commas as a separator rather than semi-columnsnutsch
@nutsch, in locals where the comma is the decimals separator, semicolons are used as argument separatorsSeanC
@SeanC, yes but not in VBA, except if you use .FormulaLocalnutsch
Easiest way to get the formula written correctly is to record a macro while you type the formula in the excel spreadsheet.nutsch

1 Answers

1
votes

You have semicolons when they should be commas.

WorkSheets("Rapport SNN").[E4].Formula = "=SUMIFS(Data!S2:Data!S2000,Data!V2:Data!V2000,""BankAxept"",Data!M2:Data!M2000,C4)/100"