- 帖子
- 2035
- 主題
- 24
- 精華
- 0
- 積分
- 2031
- 點名
- 0
- 作業系統
- Win7
- 軟體版本
- Office2010
- 閱讀權限
- 100
- 性別
- 男
- 註冊時間
- 2012-3-22
- 最後登錄
- 2024-2-1
|
回復 9# tajen
提供參考: (不知是否吻合你的需求?)- Sub 最佳五檔()
- Dim Sh As Worksheet
-
- Set Sh = Sheets("工作表3") ' 可指定工作表
-
- With Sh
- .Cells.Clear
- .Select
-
- With .QueryTables.Add(Connection:= _
- "URL;http://traderoom.cnyes.com/tse/quote2FB.aspx?code=6121", Destination:= _
- .Range("F1"))
- .WebFormatting = xlWebFormattingNone
- .WebTables = "7"
- .Refresh BackgroundQuery:=False
- End With
-
- With .QueryTables.Add(Connection:= _
- "URL;http://traderoom.cnyes.com/tse/quote2FB.aspx?code=6121", Destination:= _
- .Range("A1"))
- .WebFormatting = xlWebFormattingNone
- .WebTables = "8,10,11" ' 網頁的表格,更改 WebTables 就行了
- ' .WebTables = "7,8,10,11"
- ' .WebTables = "6,8,10,11"
- .Refresh BackgroundQuery:=False
- End With
-
- With .QueryTables.Add(Connection:= _
- "URL;http://traderoom.cnyes.com/tse/quote2FB.aspx?code=6121", Destination:= _
- .Range("I1"))
- .WebFormatting = xlWebFormattingNone
- .WebTables = "6"
- .Refresh BackgroundQuery:=False
- End With
-
- .Range("A:N").EntireColumn.AutoFit
- End With
- End Sub
複製代碼 |
|