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...
Manju1685
Apr 24, 2024Copper Contributor
HI,
Thanks for the reply but i stilll have error
function main(workbook: ExcelScript.Workbook) {
let selectedSheet = workbook.getActiveWorksheet();
// Set range B3 on selectedSheet
selectedSheet.getRange("B3").setFormulaLocal("=IF(SAPAnalyticsReportÜbersichtKP!A2<>\"\",SAPAnalyticsReportÜbersichtKP!B2)");
}
Line 4: Range setFormulaLocal: The argument is invalid or missing or has an incorrect format.
I use ; in my excel for all formulas
Thanks for the reply but i stilll have error
function main(workbook: ExcelScript.Workbook) {
let selectedSheet = workbook.getActiveWorksheet();
// Set range B3 on selectedSheet
selectedSheet.getRange("B3").setFormulaLocal("=IF(SAPAnalyticsReportÜbersichtKP!A2<>\"\",SAPAnalyticsReportÜbersichtKP!B2)");
}
Line 4: Range setFormulaLocal: The argument is invalid or missing or has an incorrect format.
I use ; in my excel for all formulas
NikolinoDE
Apr 24, 2024Platinum Contributor
Adjust the code to use semicolons (;) instead of commas (,) as argument separators in the formula, maybe this is the problem.
function main(workbook: ExcelScript.Workbook) {
let selectedSheet = workbook.getActiveWorksheet();
// Set formula in range B3 on selectedSheet
selectedSheet.getRange("B3").setFormulaLocal('=IF(SAPAnalyticsReportÜbersichtKP!A2<>""; SAPAnalyticsReportÜbersichtKP!B2; "")');
}