Excel VBA Webquey creates new column

685 Views Asked by At

for example, following query will create a new column A and the data from A column will now be in Column B

With ActiveSheet.QueryTables.Add(Connection:="URL;" & u, _
Destination:=Cells(14, 8))
    .BackgroundQuery = True
    .TablesOnlyFromHTML = True
    .Refresh BackgroundQuery:=False
    .SaveData = True
    .FieldNames = True
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = False
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .RefreshStyle = xlOverwriteCells
    .SavePassword = False
    .SaveData = True
    .RefreshPeriod = 0
    .WebSelectionType = xlEntirePage
    .WebFormatting = xlWebFormattingNone
    .WebPreFormattedTextToColumns = True
    .WebConsecutiveDelimitersAsOne = True
    .WebSingleBlockTextImport = False
    .WebDisableDateRecognition = False
    .WebDisableRedirections = False
    .Refresh BackgroundQuery:=False
    .AdjustColumnWidth = False
End With

is it possible that the destination of web query remain fixed lets say A1

1

There are 1 best solutions below

2
On BEST ANSWER

Yes. Add .RefreshStyle = xlOverwriteCells inside your With clause. This will force the external data to A1 instead of adding a new column.