Sub Germany2()
[COLOR=#008000]'Thêm dòng màu đỏ này vào:[/COLOR]
[B][COLOR=#ff0000] ActiveSheet.Cells.Clear[/COLOR][/B]
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.soccerstats.com/trends.asp?league=germany2", Destination:= _
Range("A1"))
.Name = "trends.asp?league=germany2"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "21"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.soccerstats.com/trends.asp?league=germany2", Destination:= _
Range("S1"))
.Name = "trends.asp?league=germany2_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "24"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
[COLOR=#008000]'Nếu bạn không xóa name thì mỗi lần cập nhật nó cho ra đời 2 name mới, nếu xóa thì dùng, không muốn thì bỏ những dòng màu xanh dưới đây:[/COLOR]
[COLOR=#0000ff][B] Dim n As Name
For Each n In Names
n.Delete
Next[/B][/COLOR]
End Sub