我正在将 VBA 宏转换为 Excel 脚本,以便在 Excel Web 上运行宏
VBA代码:
//Parameters is a Sheet who has startCol/endCol Cell number and startRow/endRow numbers
// Cells 3,4 is startCol; Cells 3,5 is endCol
// Cells 3,2 is startRow; Cells 3,3 is endRow
For column = Sheets("Parameters").Cells(3,4) To Sheets("Parameters").Cells(3,5)
For row = Sheets("Parameters").Cells(3,2) To Sheets("Parameters").Cells(3,3)
//then it scan the Projects Sheet and erase the values
Sheets("Projects").Cells(row, column) = ""
Next row
Next column
如何将其转换为 Javascript/Excel 脚本中的嵌套循环?
我试过类似的东西:
let usedRange = workbook.getWorksheet("Parameters").getRange("O5:GW40");
let rowCount = usedRange.getRowCount();
let columnCount = usedRange.getColumnCount();
for(let i = 1; i< columnCount; i++){
for(let j = 1; j < rowCount; j++){
if (usedRangeValues[i][j] != ""){
usedRangeValues[i][j].setValue("");
}
}
}
但我没有更进一步...