簡體   English   中英

Excel中的Applescript查找值,然后在同一行中查找另一個值

[英]Applescript in Excel to find a value and then look for another value in the same row

這聽起來很簡單(我確定是這樣),但是我不知道該怎么做:我在excel的表中有數據-假設兩列:A列包含ID,B列包含電子郵件地址。

我正在尋找一個Applescript,它將打開數據庫文件並在第一列中查找ID,但返回第二列的值供我在腳本的其余部分中稍后使用。

到目前為止,這是我所擁有的:

set theFile to POSIX path of (choose file with prompt "Choose File to Operate on")
tell application "Microsoft Excel"
activate
open theFile
set searchRange to range ("A1:D2")
try
    set foundRange to find searchRange what "ID1" with match case
    (* do something with the foundRange *)
on error -- not found
    (* do error handling *)
end try
end tell

不知道如何獲取第二列並將該值返回給ie。 設置為IDEmail?

嘗試:

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

在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM