- ©«¤l
- 9
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 50
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- office 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2019-2-6
- ³Ì«áµn¿ý
- 2022-4-12
|
[µo°Ý] Excel Ãö©óvlookup ²£¥Í NA¤Î§R°£ªÅ¥Õ¦C°ÝÃD
¥ý·PÁÂGª©¤j
¤§«e¦³ª¦¤å¬Ý¨ì
Gª©¥D À°¤H¸ÑÃD( ¦³³æ¤§¦h¦~«×°j°é¥H¤Î³æÀɪѲ¼¬Y¦~¬Y©uªº°j°é §Ú¬O±Ä¥Î³æ¦~«×¬Y©uªº°j°é )
1. ¦h¦~«×ªºµ{¦¡½X¦]¬°¤£¦P¤½¥qªº°]°È³øªíªø«×µLªk´x±±©Ò¥H¨S¨Ï¥Î³o²Õ
2. Ó¤H¨Ï¥Î³æ¦~«×¬Y©u(¥i¥H¤@¦¸§ì·j´M¦~«×¥h¦~¤Îªº·í¦~«×·í©u³øªí)ªº°j°é¨Ï¥Î¼Æȶ]¥X«á
¨Ï¥Î¦X¨Ö¸ê²£t¶Åªí¤Î¦X¨Öºî¦X·l¯qªíªí´¡¤Jvlookup«á²£¥ÍNAªº°ÝÃD- Option Explicit
- Sub Ex()
- Dim URL As String, xCo_Id As String, xSyear As String, xSseason As String
- xCo_Id = "[" & """ªÑ²¼¥N¸¹""" & "," & """2485""" & "]" 'n¨D¿é¤Jºô¶ªº°Ñ¼Æ:ªÑ²¼¥N¸¹
- xSyear = "[" & """¦~«×""" & "," & """" & Format(Date, "e") & """" & "]" 'Format(Date, "e")->¤¤µØ¥Á°êªº¦~«×
- xSseason = "[" & """©u§O""" & "," & """" & Format(Date, "q") & """" & "]" 'Format(Date, "q")->·í¦~«×ªº©u§O
- URL = "URL;http://mops.twse.com.tw/server-java/t164sb01?step=1&CO_ID=" & xCo_Id & "&SYEAR=" & xSyear & "&SSEASON=" & xSseason & "&REPORT_ID=C"
- With ActiveSheet.QueryTables.Add(Connection:=URL, Destination:=Range("A1"))
- .AdjustColumnWidth = False '¦Û°Ê½Õ¾ãÄæ¼e
- .WebSelectionType = xlSpecifiedTables
- .WebFormatting = xlWebFormattingNone
- .WebTables = "2,3,4" '¸ê²£t¶Åªí,ºî¦X·l¯qªí,²{ª÷¬y¶qªí
- .WebPreFormattedTextToColumns = True
- .WebConsecutiveDelimitersAsOne = True
- .WebSingleBlockTextImport = False
- .WebDisableDateRecognition = False
- .WebDisableRedirections = False
- .Refresh BackgroundQuery:=False
- End With
- End Sub
½Æ»s¥N½X (¥Ø«eºî¦X·l¯qªívlookupµL°ÝÃD)
°ÝÃD¡G
(1) ½Ð±Ð¸Ó¦p¦ó§R°£¶È¦³¥ª°¼¦³¤å¦r¦ý¥k°¼µL¼ÆȪº¦C ¥[¤J¨ìµ{¦¡½X·í¤¤
¡@¡@ (2)ºô¯¸§ì¤Uªº¸ê®Æ¸g¹Lvlookup ¦X¨Ö¸ê²£t¶Åªí²£¥Í¤£¦P¡u®æ¦¡¡v¦Ó·j´MÅܦ¨µ²ªG²£¥ÍNA
¤Î·j´M¤U¦]¶µ¥Ø²¤¦³¤£¦P¸Ó¦p¦ó¤~¯à¨Ï¨ç¼Æ¥¿±`¨Ï¥Î
excel.rar (55.07 KB)
|
|