我有这段代码,可以让我搜索* Excel文档中的文本,一旦找到该单元格,我就需要知道在同一行的另一列中写入文本的行。 例如:我正在寻找单元格D54中的文本,我需要在M54列中编写文本。 *搜索结果始终是唯一的。 感谢您的帮助
tell application "Microsoft Excel"
activate
set searchRange to range ("D43:D224")
set foundRange to find searchRange what "PR010111" with match case
select (foundRange)
-- set L to line of active cell
-- set value of cell "M"C to "dd/mm/aaaa"
end tell
我终于找到了解决方案。 我输入了完整的代码,因此看起来不错:
set fileName to "/Users/myUserName/Documents/myFile.xlsx"
tell application "Microsoft Excel"
activate
open fileName
set searchRange to range ("D42:D500")
set foundRange to find searchRange what "TextToSeach" with match case
select (foundRange)
set linea to the first row index of the active cell
set newCell to "O" & linea
set value of cell newCell to "Quantity"
save workbook
close workbooks
end tell