- 帖子
- 14
- 主題
- 3
- 精華
- 0
- 積分
- 52
- 點名
- 0
- 作業系統
- Windows 7
- 軟體版本
- Office 2007
- 閱讀權限
- 20
- 性別
- 男
- 來自
- 台灣
- 註冊時間
- 2014-5-7
- 最後登錄
- 2015-5-11
|
回復 1# 518587 - Sub test1()
- Dim a As String '設定a變數為字串
- Dim i As Integer '跑迴圈
-
- For i = 2 To 6 '跑回圈 因為你有五個網址 所以是從2跑到6 五次
- a = Worksheets("工作表2").Range("B" & i) 'i=2 是B2 以此類推 B3 B4 B5 B6
-
- With ActiveSheet.QueryTables.Add(Connection:= _
- "URL;http://www.atpworldtour.com/Tennis/Players/Ac/R/Ricardo-Acioly.aspx", _
- Destination:=Range("$A$1")) '以下網址是你提供 就不解說
- .Name = "Ricardo-Acioly"
- .FieldNames = True
- .RowNumbers = False
- .FillAdjacentFormulas = False
- .PreserveFormatting = True
- .RefreshOnFileOpen = False
- .BackgroundQuery = True
- .RefreshStyle = xlInsertDeleteCells
- .SavePassword = False
- .SaveData = True
- .AdjustColumnWidth = True
- .RefreshPeriod = 0
- .WebSelectionType = xlEntirePage
- .WebFormatting = xlWebFormattingNone
- .WebPreFormattedTextToColumns = True
- .WebConsecutiveDelimitersAsOne = True
- .WebSingleBlockTextImport = False
- .WebDisableDateRecognition = False
- .WebDisableRedirections = False
- .Refresh BackgroundQuery:=False
- End With
- Next i
- End Sub
複製代碼
迴圈1test.rar (15.56 KB)
|
|