Board logo

¼ÐÃD: [µo°Ý] vlookup§ì¨ú [¥´¦L¥»­¶]

§@ªÌ: cowww    ®É¶¡: 2023-7-24 09:51     ¼ÐÃD: vlookup§ì¨ú

=IFERROR(VLOOKUP($C2,'\\shl-group.com\dept\MFMG\B.¦U²Õ¸ê®Æ (Team inform)\E.¥ÍºÞ²Õ (PPC group)\X.¦Û°Ê¤Æ¤u¨ã(¤Å§R)\AL¨C¤ë¥Ø¼Ð\[AL-202306¥Ø¼Ð.xlsx]6¤ë (SAAM&FAAM)'!$B:$G,4,0),"")

¦³¿ìªk§¹¦¨¤U­±¨â­Ó±ø¥ó¶Ü??
202306->§ì¨úO3³æ¤¸®æ
6¤ëªº"6"->§ì¨úO4³æ¤¸®æ

©³¤U¬O§Úªº¼gªk¡A¦ý¬O¨S¦³§ì¨ì¥ô¦ó¸ê®Æ
=IFERROR(VLOOKUP($C2,'"\\shl-group.com\dept\MFMG\B.¦U²Õ¸ê®Æ (Team inform)\E.¥ÍºÞ²Õ (PPC group)\X.¦Û°Ê¤Æ¤u¨ã(¤Å§R)\AL¨C¤ë¥Ø¼Ð\[AL-"&O3&"¥Ø¼Ð.xlsx]"&O4&"¤ë (SAAM&FAAM)"'!$B:$G,4,0),"")
§@ªÌ: cowww    ®É¶¡: 2023-7-24 14:59

¦^´_ 1# cowww

¦P¨Æµ¹¤F§Ú¤@¬q»yªk¡A«o¥X²{¤F§ó·s¬¡­¶Ã¯³sµ²
½Ð°Ý³o¬O«ç»ò¤@¦^¨Æ??
[attach]36740[/attach]

Sub «ö¶s4_Click()

'­pºâ¿ï¶µ§ï¬°¦Û°Ê
Application.Calculation = xlCalculationAutomatic

'Ãö³¬´£¥Ü
Application.DisplayAlerts = False

    Dim formulaCell As Range
    Dim workbook_name As String
    Dim worksheet_name As String

    ' ³]¸m¨ç¼Æ¤½¦¡¦b³æ¤¸®æO2
    Set formulaCell = Worksheets("¤½¦¡(¤Å§R)").Range("O2")

    ' Àò¨ú­n©ñ¤J¤½¦¡ªºkey¡]key¦bC2Àò¨ú¡^
    Dim lookup_value As String
    lookup_value = "$C2"

    ' Àò¨ú "AL-202307¥Ø¼Ð.xlsx" ©M "7¤ë (SAAM&FAAM)"¡A¤À§O¦b³æ¤¸®æ P3 ©M P4 Àò¨ú
    workbook_name = Worksheets("¤½¦¡(¤Å§R)").Range("P3").Value
    worksheet_name = Worksheets("¤½¦¡(¤Å§R)").Range("P4").Value

    ' Ì۫ؤ½¦¡¦r²Å¦ê¡A¦}¨Ï¥Î¨â­ÓÂù¤Þ¸¹¶i¦æÂà´«
    Dim formula As String
    formula = "=IFERROR(VLOOKUP(" & lookup_value & ", '" & workbook_name & "'!" & "$B:$G, 4, 0), """")"

    ' ±N¤½¦¡©ñ¤J¤½¦¡³æ¤¸®æ O2
    formulaCell.formula = formula

    ' Ãö³¬¥´¶}ªº¤u§@ï
    Dim wb As Workbook
    Set wb = Workbooks.Open("\\shl-group.com\dept\MFMG\B.¦U²Õ¸ê®Æ (Team inform)\E.¥ÍºÞ²Õ (PPC group)\X.¦Û°Ê¤Æ¤u¨ã(¤Å§R)\AL¨C¤ë¥Ø¼Ð\" & workbook_name, UpdateLinks:=False)
    wb.Close SaveChanges:=False

'¶}±Ò´£¥Ü
    Application.DisplayAlerts = True
   
End Sub
§@ªÌ: ML089    ®É¶¡: 2023-7-24 15:48

§ï¦¨³o¼Ë¬Ý¬Ý

=IFERROR(VLOOKUP($C2,

INDIRECT("'\\shl-group.com\dept\MFMG\B.¦U²Õ¸ê®Æ (Team inform)\E.¥ÍºÞ²Õ (PPC group)\X.¦Û°Ê¤Æ¤u¨ã(¤Å§R)\AL¨C¤ë¥Ø¼Ð\[AL-" & O3 & "¥Ø¼Ð.xlsx]" & O4 & "¤ë (SAAM&FAAM)'!$B:$G")

,4,0),"")
§@ªÌ: cowww    ®É¶¡: 2023-7-24 16:26

¦^´_ 3# ML089

«D±`·PÁÂML089¤j¤jªº¸Ñ´b

¦ý¬O³o¬q¨ç¼Æ¤½¦¡¨S¦³¥ô¦ó­È¥X¨Ó
[attach]36741[/attach]
[attach]36742[/attach]
§@ªÌ: ML089    ®É¶¡: 2023-7-25 10:01

¦^´_ 4# cowww

¦b½s¿è¦C¡A¨Ï¥ÎF9¥h±Æ¬d¨C¬q¤½¦¡¸Ìªº°Ñ¼Æ©Î­È¬O­þ¸Ì¦³°ÝÃD
§@ªÌ: cowww    ®É¶¡: 2023-7-26 08:06

¦^´_ 5# ML089

«D±`·PÁÂML089¤j¤jªº¸Ñ´b

¦ý¬O«ö¤UF9¤§«á¤½¦¡®ø¥¢¡A¤]¨S¦³¼Æ­È¶]¥X¨Ó
§@ªÌ: ML089    ®É¶¡: 2023-7-27 11:18

¦^´_ 6# cowww

INDIRECT("'\\shl-group.com\dept\MFMG\B.¦U²Õ¸ê®Æ (Team inform)\E.¥ÍºÞ²Õ (PPC group)\X.¦Û°Ê¤Æ¤u¨ã(¤Å§R)\AL¨C¤ë¥Ø¼Ð\[AL-" & O3 & "¥Ø¼Ð.xlsx]" & O4 & "¤ë (SAAM&FAAM)'!$B:$G")

    §A­n¥ý¿ï¨ú "'\\shl-group.com\dept\MFMG\B.¦U²Õ¸ê®Æ (Team inform)\E.¥ÍºÞ²Õ (PPC group)\X.¦Û°Ê¤Æ¤u¨ã(¤Å§R)\AL¨C¤ë¥Ø¼Ð\[AL-" & O3 & "¥Ø¼Ð.xlsx]" & O4 & "¤ë (SAAM&FAAM)'!$B:$G"
    «öF9¡A¬Ý¥X²{ªº¤å¦r¬O§_§A­nªºÀx¦s®æ¦ì¸m
§@ªÌ: ­ã´£³¡ªL    ®É¶¡: 2023-7-29 17:02

¦p¤U¥u¬O¥Ü¨Ò//¦Û¤v®M¥Î¬Ý¬Ý

Fx$ = "=IFERROR(VLOOKUP($C2,'\\shl-group.com\dept\MFMG\B.¦U²Õ¸ê®Æ (Team inform)\E.¥ÍºÞ²Õ (PPC group)\X.¦Û°Ê¤Æ¤u¨ã(¤Å§R)\AL¨C¤ë¥Ø¼Ð\[AL-xYM¥Ø¼Ð.xlsx]xMon¤ë (SAAM&FAAM)'!$B:$G,4,0),"""")"

¦~¤ë$="202306"  --«ü©wÀx¦s®æ
¤ë¥÷$="6"  --«ü©wÀx¦s®æ

Fx=replace(replace(Fx, "xYM", ¦~¤ë), "xMon", ¤ë¥÷)

formulacell.formual = Fx
§@ªÌ: cowww    ®É¶¡: 2023-7-31 11:22

¦^´_ 7# ML089


«D±`·PÁÂML089¤j¤jªº¸Ñ´b

«ö¤UF9½T¹ê"O3"&"O4"¦³Åܦ¨§Ú·Q­nªº¼Æ¦r
¦ý¬O¬°¦ó·|¨S§ì¨ìÀÉ®×ùØ­±ªº¼Æ¦r©O??
§@ªÌ: cowww    ®É¶¡: 2023-7-31 11:24

¦^´_ 8# ­ã´£³¡ªL

«D±`·PÁ­㴣³¡ªL¤j¤jªº¸Ñ´b
«Ü½ÆÂøªº¤½¦¡
¬Ý¤£À´¡A¤p§Ì»Ý­n®É¶¡¬ã¨s
§@ªÌ: cowww    ®É¶¡: 2023-7-31 15:55

¦^´_ 8# ­ã´£³¡ªL

¤½¦¡¸òVBA³£¶]¥X¨Ó¤F

«D±`·PÁÂML089¤j¤jªº¸Ñ´b
«D±`·PÁ­㴣³¡ªL¤j¤jªº¸Ñ´b




Åwªï¥úÁ{ ³Â»¶®a±Ú°Q½×ª©ª© (http://forum.twbts.com/)