·sª©ªÑ¥«¤½¶}¸ê°TÆ[´ú¯¸ªº¸ê®Æ§ì¨ìEXECL?
- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ 29# chang0833
¦^´_ 28# GBKEE
GBKEE ª©¤j
°²³]¦pªG±N¡G
X = Year(Date) - 1910 ' ¤¤µØ¥Á°êªº¦~«×
For xSyear = X To X - 3 Step -1 ' °j°é: ¦~«× ' 105->102
קאּ¡G
X = Year(Date) - 1911 ' ¤¤µØ¥Á°êªº¦~«×
For xSyear = X To X - 2 Step -1 ' °j°é: ¦~«× ' 104->102 ³Ì·sªº¦~«×©¹«e¬d«e¤G¦~ªº¸ê®Æ
«h¥»¦~«×¸ê°T·|±q ¡y"$A$1"¡z¦ì§}¶}©l¦C¦L¡A§_«h·|±q ¡y"$A$13"¡z¦ì§}¶}©l¦C¦L¡C
³o°¦µ{¦¡«D±`ºë²©öÄý¡A§Ú·|¦n¦n«O¦s³Æ¿ýªº¡AÁÂÁ GBKEE ±zªº«ü¾É¡I- "$A$1" 2015¦~3¤ë31¤é 2014¦~12¤ë31¤é 2014¦~3¤ë31¤é
- "$A$282" 2015¦~6¤ë30¤é 2014¦~12¤ë31¤é 2014¦~6¤ë30¤é
- "$A$567" 2015¦~9¤ë30¤é 2014¦~12¤ë31¤é 2014¦~9¤ë30¤é
- "$A$856" 2015¦~²Ä3©u 2014¦~²Ä3©u 2015¦~01¤ë01¤é¦Ü2015¦~09¤ë30¤é 2014¦~01¤ë01¤é¦Ü2014¦~09¤ë30¤é
- "$A$859" 2014¦~3¤ë31¤é 2013¦~12¤ë31¤é 2013¦~3¤ë31¤é
- "$A$1133" 2014¦~6¤ë30¤é 2013¦~12¤ë31¤é 2013¦~6¤ë30¤é
- "$A$1409" 2014¦~9¤ë30¤é 2013¦~12¤ë31¤é 2013¦~9¤ë30¤é
- "$A$1688" 2014¦~12¤ë31¤é 2013¦~12¤ë31¤é
- "$A$1971" 2013¦~3¤ë31¤é 2012¦~12¤ë31¤é 2012¦~3¤ë31¤é 2012¦~1¤ë1¤é
- "$A$2247" 2013¦~6¤ë30¤é 2012¦~12¤ë31¤é 2012¦~6¤ë30¤é 2012¦~1¤ë1¤é
- "$A$2530" 2013¦~9¤ë30¤é 2012¦~12¤ë31¤é 2012¦~9¤ë30¤é 2012¦~1¤ë1¤é
- "$A$2812" 2013¦~12¤ë31¤é 2012¦~12¤ë31¤é 2012¦~1¤ë1¤é
- ~
- "$A$3092"
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 23
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 58
- ÂI¦W
- 0
- §@·~¨t²Î
- windows
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2014-2-26
- ³Ì«áµn¿ý
- 2018-8-23
|
¦^´_ 28# GBKEE
·PÁª©¤j¡A¥Ø«e¤U¸ü¨S°ÝÃD¤F¡AÁÂÁÂ^^
¥Ø«e¥ý¨ÓºCºC¬ã¨sª©¤jªºµ{¦¡¡A¤Ó·P®¦¤F^^ |
|
|
|
|
|
|
- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 27# chang0833
¸Õ¸Õ¬Ý(¥þ³¡)- Option Explicit
- Sub Ex()
- Dim URL As String, xCo_Id As String, X As Integer, Rng As Range
- Dim E As Variant, xSyear As Integer, xSseason As Integer, D_Name As String
-
- With ActiveSheet
- For Each E In .QueryTables 'WEB¬d¸ßª«¥ó¶°¦X
- E.Delete
- Next
- For Each E In .Names 'Name ª«¥óªº¶°¦X
- .Names(E.Name).Delete
- Next
- .UsedRange.Clear
- Set Rng = .Range("a1") '«ü©w¤u§@ªí¤W WEB¬d¸ßªº¦ì¸m
- End With
- xCo_Id = Application.InputBox("½Ð¿é¤JªÑ²¼¥N¸¹", , 2303) '¹w³]¬° 2303
- X = Year(Date) - 1910 '¤¤µØ¥Á°êªº¦~«×
- For xSyear = X To X - 3 Step -1 '°j°é:¦~«× '105->102
- 'For xSyear = X - 3 To X '°j°é:¦~«× '102->105
- For xSseason = 1 To 4 ' '°j°é:©u§O '1,2,3,4
- 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:=Rng)
- .Name = xCo_Id & "_" & xSyear & "_²Ä" & xSseason & "©u" 'WEB¬d¸ßªº¦WºÙ
- .AdjustColumnWidth = True '¦Û°Ê½Õ¾ãÄæ¼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
- If .ResultRange.Rows.Count = 2 Then 'µL¸ê®Æ
- D_Name = .Name 'WEB¬d¸ßªº¦WºÙ
- .Delete '§R°£:WEB¬d¸ß
- With Rng.Parent
- For Each E In .Names
- If InStr(E.Name, D_Name) Then E.Delete '§R°£:¤u§@ªí¤Wªº¦WºÙ->WEB¬d¸ßªº¦WºÙ
- Next
- End With
- Else
- With .ResultRange 'WEB¬d¸ß¸ê®Æªº½d³ò
- Set Rng = .Cells(.Rows.Count + 2, 1) '¤U¤@WEB¬d¸ßªº¦ì¸m
- End With
- End If
- End With
- Next
- Next
- MsgBox "Ok"
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 23
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 58
- ÂI¦W
- 0
- §@·~¨t²Î
- windows
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2014-2-26
- ³Ì«áµn¿ý
- 2018-8-23
|
¦^´_ 26# GBKEE
·PÁª©¤jªº¼ö¤ß¦^´_¡A´î»´«Ü¦h¾Ç²ß¤Wªº§xÂZ^^
¦A½Ð±Ð¤@¤Uª©¤j©Ò¼gªº³o¬qµ{¦¡¡A¥u¯à±N¿é¤J³Ì·sªº¦~«×©¹«e¬d«e¤G¦~ªº¸ê®Æ
¡A¦ý¤µ¦~ªº¸ê®Æ·|µLªk¬d¸ß¡A¸Ó¦p¦óÅý¤µ¦~ªº¸ê®Æ¤]¥i¥H¤U¸ü¡A
¦b³Ò·Ðª©¤j¤F¡AÁÂÁÂ^^
For Each xSseason In Array(2, 3, 4, 1) '°j°éxSseason => 2, 3, 4, 1
xSyear = "" & IIf(xSseason > 1, X - 2, X - 1) |
|
|
|
|
|
|
- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 25# chang0833
¤w×§ï ¸Õ¸Õ¬Ý- Option Explicit
- Sub Ex()
- Dim URL As String, xCo_Id As String, xSyear As String, X As Integer, Rng As Range
- Dim xSseason As Variant
- xCo_Id = Application.InputBox("½Ð¿é¤JªÑ²¼¥N¸¹", , 2303) '¹w³]¬° 2303
- X = Application.InputBox("½Ð¿é¤J³Ì·s¦~«×", , Year(Date) - 1911) '¤¤µØ¥Á°êªº¦~«×
-
- With ActiveSheet
- For Each xSseason In .QueryTables 'WEB¬d¸ßª«¥ó¶°¦X
- xSseason.Delete
- Next
- For Each xSseason In .Names 'Name ª«¥óªº¶°¦X
- .Names(xSseason.Name).Delete
- Next
- .UsedRange.Clear
- Set Rng = .Range("a1") '«ü©w¤u§@ªí¤W WEB¬d¸ßªº¦ì¸m
- End With
- '''''''''''''''''''
- For Each xSseason In Array(2, 3, 4, 1) '°j°éxSseason => 2, 3, 4, 1
- xSyear = "" & IIf(xSseason > 1, X - 2, X - 1)
- 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:=Rng)
- .Name = xCo_Id & "-" & xSyear & "- ²Ä " & xSseason & " ©u" 'WEB¬d¸ßªº¦WºÙ
- .AdjustColumnWidth = True '¦Û°Ê½Õ¾ãÄæ¼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
- With .ResultRange 'WEB¬d¸ß¸ê®Æªº½d³ò
- Set Rng = .Cells(.Rows.Count + 2, 1) '¤U¤@WEB¬d¸ßªº¦ì¸m
- End With
- End With
- Next
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 23
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 58
- ÂI¦W
- 0
- §@·~¨t²Î
- windows
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2014-2-26
- ³Ì«áµn¿ý
- 2018-8-23
|
ª©¤j¡G§Ú°õ¦æ«á¡Aºô¶¸ê®Æ³£¬O±q²Ä¤@¦C¶}©l±Æ¦C¡A¦b°õ¦æ¨ì¤U¤@©u®É·|§â¸ê®Æ©¹¥k±À
¡A¦ý¹J¨ì°]³ø²Ä¥|©u®É¡A¦]¨ä®æ¦¡»P¨ä¥L¤T©u¤£¦P¡A¾ÉP§ó·s¸ê®Æ°_©l¤£¦P¦Ó§ïÅܸê®Æ¦ì¸m
¡A©Ò¥H§Ú»Ýn§â¨C¤@©uªº¤U¸ü¦ì¸m¡A³£©ñ¦b©T©wÀx¦s¦ì¸m¡A¸ê®Æ¤~¤£·|¨C¦¸³£¤£¤@¼Ë
¦b³Ò·Ðª©¤j¤F^^ÁÂÁÂ
Dim URL As String, xCo_Id As String, xSyear As String, xSseason As String
K = Application.InputBox("½Ð¿é¤JªÑ²¼¥N¸¹")
X = Application.InputBox("½Ð¿é¤J³Ì·s¦~«×")
Y = X - 1
Z = X - 2
xCo_Id = "" & K 'n¨D¿é¤Jºô¶ªº°Ñ¼Æ:ªÑ²¼¥N¸¹
xSyear = "" & Z 'Format(Date, "e")->¤¤µØ¥Á°êªº¦~«×
xSseason = "2" '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 = True '¦Û°Ê½Õ¾ãÄæ¼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
xCo_Id = "" & K 'n¨D¿é¤Jºô¶ªº°Ñ¼Æ:ªÑ²¼¥N¸¹
xSyear = "" & Z 'Format(Date, "e")->¤¤µØ¥Á°êªº¦~«×
xSseason = "3" '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 = True '¦Û°Ê½Õ¾ãÄæ¼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
xCo_Id = "" & K 'n¨D¿é¤Jºô¶ªº°Ñ¼Æ:ªÑ²¼¥N¸¹
xSyear = "" & Z 'Format(Date, "e")->¤¤µØ¥Á°êªº¦~«×
xSseason = "4" '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 = True '¦Û°Ê½Õ¾ãÄæ¼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
xCo_Id = "" & K 'n¨D¿é¤Jºô¶ªº°Ñ¼Æ:ªÑ²¼¥N¸¹
xSyear = "" & Y 'Format(Date, "e")->¤¤µØ¥Á°êªº¦~«×
xSseason = "1" '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 = True '¦Û°Ê½Õ¾ãÄæ¼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 |
|
|
|
|
|
|
- ©«¤l
- 23
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 58
- ÂI¦W
- 0
- §@·~¨t²Î
- windows
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2014-2-26
- ³Ì«áµn¿ý
- 2018-8-23
|
¦^´_ 22# chang0833
·PÁª©¤j¡A¥N¸¹¿é¤J°ÝÃD¤w¸g¸Ñ¨M^^
¦A½Ðª©¤j¸Ñ¨M¤@Ó°ÝÃD¡An¦p¦ó¨Ï¤U¸ü¤U¨Óªº¸ê®Æ¡A©ñ¦b«ü©wªºÀx¦s®æ¦ì¸m??
·Ð½Ð½ç±Ð¤F¡AÁÂÁÂ^^ |
|
|
|
|
|
|
- ©«¤l
- 23
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 58
- ÂI¦W
- 0
- §@·~¨t²Î
- windows
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2014-2-26
- ³Ì«áµn¿ý
- 2018-8-23
|
¦^´_ 21# chang0833
½Ð°Ýª©¤j¡A§Ú¥Î³Ì²Âªº¤è¦¡½Æ»s¤F¤K¦¸µ{¦¡(©T©w¦~«×¤Î©u§O)¡AÁ`©ó¥i¥H¶]¥X¨Ó¤F¡A¥i¬O"ªÑ²¼¥N¸¹"¥i§_³]p¤@Ó¥i¥H¦Û¥Î½Õ¾ãªºÅܼƨӿé¤J
"xCo_Id = "K" 'n¨D¿é¤Jºô¶ªº°Ñ¼Æ:ªÑ²¼¥N¸¹"¡K¡K³o¤@¦æ¸Ó¦p¦ó¼g¡A©ÎªÌ¦³¨ä¥¦§ó¦nªº¤è¦¡¡C
·Ð½Ðª©¤j½ç±Ð¤F¡A·P¿E¤£ºÉ¡AÁÂÁ¡C
Dim URL As String, xCo_Id As String, xSyear As String, xSseason As String
xCo_Id = "K" 'n¨D¿é¤Jºô¶ªº°Ñ¼Æ:ªÑ²¼¥N¸¹
xSyear = "102" 'Format(Date, "e")->¤¤µØ¥Á°êªº¦~«×
xSseason = "2" '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 = True '¦Û°Ê½Õ¾ãÄæ¼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 |
|
|
|
|
|
|
- ©«¤l
- 23
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 58
- ÂI¦W
- 0
- §@·~¨t²Î
- windows
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2014-2-26
- ³Ì«áµn¿ý
- 2018-8-23
|
¦^´_ 8# GBKEE
ª©¤j³oÓµ{¦¡¯uªº«Ü¦n¥Î¡A
§Ú¬OEXCEL VBAªì¾ÇªÌ¡AÁÙ¦b¼Ò¯Á¶¥¬q¡KµhW¾Ç²ß¤¤
¥i¥HÀµ½Ðª©¤j¦b¤j¤OÀ°¦£¤@¤U¡A¦p¦ó¯à¤@¦¸¤U¸ü³Ì·s8©uªº¸ê®Æ¤Î¦b¶}ÀY¦C¥XªÑ¦W©Î¥N¸¹
·P¿E¤£ºÉ¡AÁÂÁ |
|
|
|
|
|
|