使用Apple脚本在A列的Excel电子表格中查找产品代码,并通过C行中的剪贴板查看值?

非常感谢您的帮助。

我有一个电子表格,列中列出产品的行和详细信息。

我想获得excel来find列A中的产品代码,然后将已经在剪贴板中的相应值粘贴到列C中。我正在使用以下脚本:

tell application "Microsoft Excel" set searchRange to range ("A1:A5") set foundRange to find searchRange what "AM100" with match case set fRow to first row index of foundRange set myData to value of range ("B" & fRow as text) set theClip to the clipboard as text end tell 

我似乎无法使粘贴发生在产品代码已find的同一行的列C中。

请帮忙…

非常感谢Darryl

试试这个解决scheme。

它会用剪贴板文本查找并replacesearch词的每个实例。

 tell application "Microsoft Excel" set search_range to range "A:A" -- look in column A set search_term to "AM100" set found_range to "" set counter to 0 try set found_range to find search_range what search_term look at whole with match case on error log ("No matches found") end try if (found_range is not "") then set first_cell_address to (get address of the cells of found_range) log ("first_cell_address = " & first_cell_address) repeat while true set cur_row to the first row index of found_range set mod_cell to cell cur_row of column 3 -- the same row in C column set value of mod_cell to (the clipboard as text) set counter to counter + 1 -- Now look for next result set found_range to find next search_range after found_range set cell_address to (get address of the cells of found_range) if (cell_address = first_cell_address) then -- have looped around so we are finished! exit repeat end if end repeat end if log ("found " & counter & " items") end tell 

Applescript-Excel可能相当混乱,但至less仍然支持(*咳嗽*苹果)