How do I prevent a web query inserting a new column for the Destination?

travellerva

New Member
Joined
Mar 31, 2012
Messages
47
Office Version
  1. 365
Platform
  1. MacOS
I have coded a web query as follows:
Code:
With ActiveSheet.QueryTables.Add(Connection:= _
    "URL;https://query2.finance.yahoo.com/v7/finance/options/" & UnderlyingSymbol & "?date=" & ExpiryEpoch & "", _
    Destination:=Range("OptionQuote"))
    .BackgroundQuery = True
    .TablesOnlyFromHTML = True
    .Refresh BackgroundQuery:=False    'Go to Yahoo and fetch the option chain quotes
    .SaveData = True
End With

The destination range of "OptionQuote" is set as a single cell in column A. When I run the macro, Excel inserts a new column A and saves the web query result in that column. When I tried changing the destination to Range("OptionQuote").Offset(0,1) the result was saved in an inserted column offset to the right. I tried specifying Range("OptionQuote").Offset(0,0) but the outcome was the same as if there was no offset.

Any ideas as to how I can prevent the insertion of a column?

Thanks
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top