- ©«¤l
- 4
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 5
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- 2010
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2014-6-5
- ³Ì«áµn¿ý
- 2022-3-11
|
[µo°Ý] §ì¨ú¤W¥«ÂdÁÙìªÑ»ù«á¡A¦p¦ó½Õ¾ã¤é´Á±Æ§Ç¤Î¬D¥X«e5¦~ªº¨C¦~°ª§CÂI
¥»½g«Y°Ñ¦Òhttp://ric1565.blogspot.tw/2015/02/blog-post_24.html .
½Ð±Ð¦U¦ì¥ý¶i¡A¸g§ì¨úªÑ»ù¸ê®Æ«á¡A¤é´ÁÀ³¦p¦ó±N³Ìªñªº¤é´Á¥Ñ¤W©¹¤U±Æ§Ç¡A¨Ã¦p¦ó¬D¥X«e5¦~ªº¨C¦~ªÑ»ù³Ì°ª¤Î³Ì§CÂI¡C
µ{¦¡½X¦p¤U¡G
Sub ComBoxInit()
With ComboBox2
.List = Array("¤é½u", "ÁÙì¤é½u")
.Text = "²M³æ"
End With
End Sub
Private Sub ComboBox2_Change()
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub CommandButton1_Click()
Dim web
Dim URL As String, code As String
Dim i As Long, j As Integer, d As Integer
If TextBox1.Text = "" Then Exit Sub
code = TextBox1.Text
URL = "http://jsstock.wls.com.tw/Z/ZC/ZCW/CZKC1.djbcd?c=402&b=" & IIf(ComboBox2.Text = "ÁÙì¤é½u", "A", _
IIf(ComboBox2.Text = "¦W¥Ø¶g½u", "W", "M")) & "&a=" & code
Set web = CreateObject("Microsoft.XMLHTTP")
web.Open "get", URL, False
web.send
ReDim arr(1 To Int((Len(web.responseText) - Len(Replace(web.responseText, ",", ""))) / _
(Len(web.responseText) - Len(Replace(web.responseText, " ", "")) + 1)) + 1, 1 To 6)
For i = 1 To 6
For j = 1 To Int((Len(web.responseText) - Len(Replace(web.responseText, ",", ""))) / _
(Len(web.responseText) - Len(Replace(web.responseText, " ", "")) + 1)) + 1
arr(j, i) = Application.Index(Split(Application.Index(Split(web.responseText, " "), 1, i), ","), 1, j)
Next j
Next i
Do Until Application.WorksheetFunction.CountA(ActiveSheet.UsedRange) = 0
ActiveSheet.Cells.Delete
ActiveSheet.Cells.Clear
Loop
Range(Cells(2 + 1, 1 + 1), Cells(2 + j - 1, 1 + i - 1)) = arr
Cells(2, 2) = "¤é´Á"
Cells(2, 3) = "¶}½L"
Cells(2, 4) = "³Ì°ª"
Cells(2, 5) = "³Ì§C"
Cells(2, 6) = "¦¬½L"
Cells(2, 7) = "¦¨¥æ¶q"
With ActiveWorkbook.ActiveSheet.Sort
.SetRange Range("B3:" & Application.WorksheetFunction.Index(Split(ActiveSheet.UsedRange.Address, ":"), 1, 2))
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
If Cells(65536, 2).End(xlUp).Row > 2 Then
For d = 1 To Year(Cells(3, 2)) - Year(Cells(65536, 2).End(xlUp))
Cells(2 + d, 9) = Year(Cells(3, 2)) - (d - 1)
Cells(2, 12) = 3
Cells(2 + d, 12).Formula = "=Match(" & (DateSerial(Year(Date) - d, 12, 31) + 0.1) * 1 & ",B:B,-1)"
Cells(2 + d, 10) = Application.WorksheetFunction.Max(Range(Cells(Cells(1 + d, 12), 4), Cells(Cells(2 + d, 12), 4)))
Cells(2 + d, 11) = Application.WorksheetFunction.Min(Range(Cells(Cells(1 + d, 12), 5), Cells(Cells(2 + d, 12), 5)))
Next d
End If
Cells(3, 9) = "¦~«×"
Cells(4, 9) = "³Ì°ª"
Cells(5, 9) = "³Ì§C"
Columns(12).Delete
With ActiveSheet
.Columns("C:F").NumberFormatLocal = "0.00"
.Columns("J:K").NumberFormatLocal = "0.00"
.Columns("B:B").NumberFormatLocal = "yyyy/mm/dd"
.UsedRange.Columns.AutoFit
.Cells(1, 1).Select
.Rows("1:2").RowHeight = 30
End Sub
[attach]20760[/attach] |
-
-
¬¡¶Ã¯2.rar
(55.84 KB)
|