Forum Discussion
8932LDG
Jun 14, 2023Copper Contributor
Error when recording a macro (argument is invalid or missing or has an incorrect format)
I'm trying to automate a set of operations in Excel and recorded a macro. The macro gives the following error: Line 56: Range setFormulaLocal: The argument is invalid or missing or has an incorre...
8243BA
Jan 15, 2025Copper Contributor
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?