Which version of MS Excel: 2007?
In my opinion, your code is not optimal and have no context.
Why?
1) Try to run this code on Sheet1, Sheet2 or Sheet3 and on any sheet with data. You'll lost your data!
2) Your application is as quick as your code.
Option Explicit 'declare variables
Sub CreateQT(qurl As String)
Dim wsh As Worksheet, dstRange As Range
Dim qt As QueryTable
'ignore errors and delete existing QueryTable
On Error Resume Next
Set qt = wsh.QueryTables(1)
If Not qt Is Nothing Then qt.Delete
'on error go to error handler
On Error GoTo Err_CreateQT
'create object variable: Worksheet
Set wsh = ThisWorkbook.Worksheets(1)
'create object variable: Range
Set dstRange = wsh.Range("C7")
'create object variable: QueryTable
Set qt = wsh.QueryTables.Add("URL;" & qurl, dstRange, sSQL)
With qt
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.SaveData = True
End With
dstRange.TextToColumns Destination:=dstRange, DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=True, Space:=False, other:=False
wsh.UsedRange.ColumnWidth = 8
Exit_CreateQT:
On Error Resume Next
'delete every object variables
Set dstRange = Nothing
Set wsh = Nothing
Set qt = Nothing
Exit Sub
Err_CreateQT:
MsgBox Err.Description, vbExclamation, Err.Number
Resume Exit_CreateQT
End Sub