travellerva
New Member
- Joined
- Mar 31, 2012
- Messages
- 47
- Office Version
- 365
- Platform
- MacOS
I have coded a web query as follows:
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
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