[算表] VBA vlookup雙重查找

看板Office作者 (Jtin 介)時間11年前 (2015/02/01 00:07), 11年前編輯推噓0(008)
留言8則, 2人參與, 最新討論串1/1
軟體:VBA 版本:2007 Into_Date_B = "=(match(" & Into_Date & "," & (j * 100) & ".txt" & "!$A:$A,0))" Into_Date_E = "=(match(" & Into_Date & "," & (j * 100) & ".txt" & "!$A:$A,1))" If Cells(i, 18) = j * 100 Then ActiveSheet.Cells(i, 29).Value = "=vlookup(" & Into_Time & ",(INDIRECT(" & (j * 100) & ".txt" & "!$B" & Into_Date_B & ":$H" & Into_Date_E & ")),5,0)" 請問 為什麼 into_date_B 和 into_date_E 改成單純數字的時候 就能夠正常 但是如上述這樣寫就有問題 問題在於 into_date_B 和into_date_E他們回傳的是公式 但不是數值 可以讓他只回傳計算結果嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.115.222.67 ※ 文章網址: https://www.ptt.cc/bbs/Office/M.1422720477.A.3E6.html

02/01 00:15, , 1F
是否提供檔案呢?
02/01 00:15, 1F

02/01 00:24, , 2F
Into_Date_B 與 Into_Date_E 是可以正常跑出正確值
02/01 00:24, 2F

02/01 00:25, , 3F
檔案的話要處理處理@@"
02/01 00:25, 3F

02/01 00:26, , 4F
他其實牽扯到多個檔案的處理 .txt是其他檔案
02/01 00:26, 4F
※ 編輯: winnina1 (59.115.222.67), 02/01/2015 00:32:58 ※ 編輯: winnina1 (59.115.222.67), 02/01/2015 08:44:12

02/01 09:21, , 5F
回傳計算結果方面可google excel vba evaluate
02/01 09:21, 5F

02/01 09:26, , 6F
簡寫則為中括號[公式]
02/01 09:26, 6F

02/01 09:34, , 7F
如以原文中會以字串連結變數的話,則以evaluate
02/01 09:34, 7F

02/06 22:13, , 8F
後來直接跳過寫成數值的過程 直接用evalue帶進去即可
02/06 22:13, 8F
文章代碼(AID): #1KpFtTFc (Office)
文章代碼(AID): #1KpFtTFc (Office)