返回列表 上一主題 發帖

上網抓股票資料

回復 5# chairles59
你試試
  1. Sub 價位更新()
  2.     Application.ScreenUpdating = False
  3.     Sheets(1).Activate
  4.     rc = Cells(Rows.Count, 1).End(xlUp).Row
  5.     For i = 3 To rc
  6.         Range("r1:az10").ClearContents
  7.         sn = Cells(i, 1)
  8.         With ActiveSheet.QueryTables.Add(Connection:="URL;https://tw.stock.yahoo.com/q/q?s=" & sn, Destination:=Range("$s$1"))
  9.             .WebFormatting = xlWebFormattingNone
  10.             .WebTables = "4,7"
  11.             .Refresh BackgroundQuery:=False
  12.             .Delete
  13.         End With
  14.         Range("b1") = Left(Range("w1"), 10)
  15.         Cells(i, 10) = Range("t5")
  16.         Cells(i, 9) = Range("u5")
  17.     Next
  18.     Range("r1:az10").ClearContents
  19.     Range("a1").Select
  20.     Application.ScreenUpdating = True
  21. End Sub
複製代碼
股票.zip (18.68 KB)

TOP

        靜思自在 : 信心、毅力、勇氣三者具備,則天下沒有做不成的事。
返回列表 上一主題