Sub GetNSEData()
' Download one stock only
Dim DataSheet As Worksheet
Dim qurl As String
Dim nQuery As Name
Application.ScreenUpdating = True
Application.DisplayAlerts = False
Application.Calculation = xlCalculationAutomatic
Set DataSheet = ActiveSheet
Range("C7").CurrentRegion.ClearContents
'construct the URL for the query
qurl = "https://www.nseindia.com/products/dynaContent/common/productsSymbolMapping.jsp?instrumentType=FUTSTK&symbol=YESBANK&expiryDate=30-03-2017&optionType=&strikePrice=&dateRange=3month&fromDate=&toDate=&segmentLink=9&symbolCount=2"
QueryQuote:
With ActiveSheet.QueryTables.Add(Connection:="URL;" & qurl, Destination:=DataSheet.Range("C7"))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With
'turn calculation back on
Application.DisplayAlerts = True
Range("A1").Select
End Sub
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.