我需要一个applescript来删除excel中不包含我想要在第1行中的文本的任何列。我的脚本在下面,用于删除第1行中包含“REC_ID、F_STATUS或EVENT_ID”的列。
set myValues to "REC_ID, F_STATUS, EVENT_ID"
tell application "Microsoft Excel"
set columnCount to (((count of columns of used range of active sheet)) + 1)
repeat with i from columnCount to 1 by -1
set cellValue to value of cell ("1" & i)
if cellValue is not in myValues then
delete column i
end if
end repeat
end tell
我不断收到此错误错误“Microsoft Excel 出错:您尝试访问的对象不存在”单元格“133”的值中的数字 -1728。
谢谢您的帮助!