vba呼叫javascript函式封裝
阿新 • • 發佈:2019-02-15
//返回單元格值 function getValue(sheet, row, col) { if(col==undefined) { return sheet.range(row).value; } else { return sheet.cells(row, col).value; } } //設定單元格值 function setValue(sheet, value, row, col) { if(col==undefined) { sheet.range(row).value = value; } else { sheet.cells(row, col).value = value; } }
//過濾
function filter(sheet, rangeStr, col, value) {
sheet.range(rangeStr).AutoFilter(col, value);
}
//取消過濾
function filterCancel(sheet, rangeStr) {
sheet.range(rangeStr).AutoFilter;
}
//排序 1:升序;2:降序 function sort(sheet, sectionRangeStr, byRangeStr, order){ order = order===undefined ? 1 : order; sheet.range(sectionRangeStr).sort(sheet.range(byRangeStr+"1"), order); }