作者windknife18 (windknife18)
標題Re: [算表] 如何自動更新活頁簿連結的路徑和檔名?
時間Sun Feb 23 22:54:57 2025
VBA 版本
檔案位置:
http://file.wikidot.com/local--files/f/20250223_VBA_Xlookup.xlsm
可以按 Alt+F11 查看程式碼
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("D2:E2"), Range(Target.Address)) _
Is Nothing Then
Cells(2, 3).Formula2 = "=XLOOKUP(A1#,'C:\Users\家人\Desktop\01月\[" & _
Right("00" & Cells(2, 4), 2) & Right("00" & Cells(2, 5), 2) & _
"-出貨單.xlsx]清單'!$A:$A,'C:\Users\家人\Desktop\01月\[" & _
Right("00" & Cells(2, 4), 2) & _
Right("00" & Cells(2, 5), 2) & "-出貨單.xlsx]清單'!$B:$B,"""")"
End If
End Sub
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.34.58.193 (臺灣)
※ 文章網址: https://webptt.com/m.aspx?n=bbs/Office/M.1740322500.A.D62.html
1F:推 randyus: 多謝大大的分享,開啟學習VBA的坎苛路程中 XD 02/24 00:12
2F:→ windknife18: 不客氣,以祝你學習順利 :) 02/24 10:03