我试图编写一个循环浏览Excel电子表格范围内每个单元格的Applescript,并将单元格值和单元格地址记录在" $ A $ 1"格式。我可以获得单元格值,我可以完整地参考单元格位置(例如,单元格" $ A $ 2"范围" A2:B10"表单#34 ; Sheet1"应用程序的活动工作簿" Microsoft Excel"),但我不知道如何自己提取单元格引用(例如," $ A $ 2& #34;。)
set addressList to {}
tell application "Microsoft Excel"
tell sheet "Sheet1" of active workbook
set myRange to range "A2:B10"
repeat with j from 1 to count of every cell in myRange
set end of addressList to cell j of myRange
end repeat
end tell
end tell
addressList
答案 0 :(得分:1)
使用get address
命令
set addressList to {}
tell application "Microsoft Excel"
tell sheet "Sheet1" of active workbook
set myRange to range "A2:B10"
repeat with j from 1 to count of every cell in myRange
set end of addressList to get address of cell j of myRange
end repeat
end tell
end tell
addressList