Forum Discussion
Error when recording a macro (argument is invalid or missing or has an incorrect format)
Hi, I'm encountering the same issue, and I'm struggling to understand what I've done wrong?
The message I receive is: "Line 4: Range setFormulaLocal: The argument is invalid or missing or has an incorrect format."
The formula I added was:
=VLOOKUP($A3; [20241108_0838kinamureporter_Provisionsunderlag.xlsx]Worksheet!$A$1:$K$10001;2; 2)
I was asked to restore to calculated formula:
=VLOOKUP([@Ombundsnr];'20241108_0838kinamureporter_Provisionsunderlag.xlsx'!Table1[[Ombudsnr]:[Orgnr]];2;2)
Neither work in the recorded script when it is run. What is shown is:
let selectedSheet = workbook.getActiveWorksheet();
// Set range D3 on selectedSheet
selectedSheet.getRange("D3").setFormulaLocal("=VLOOKUP($A3, [20241108_0838kinamureporter_Provisionsunderlag.xlsx]Worksheet!$A$1:$K$10001, 2, 2)");
// Auto fill range
selectedSheet.getRange("D3").autoFill("D3:D25", ExcelScript.AutoFillType.fillDefault);
Any ideas?