Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Need To remove Extra Column adding, while downloading through vba

Avatar of vijay vj
vijay vjFlag for India asked on
Microsoft OfficeMicrosoft ExcelVBA
1 Comment1 Solution100 ViewsLast Modified:
Dear sir,

 I have a vba  code where it will download the data from web to excel , but the problem is that while downloading in my worksheet extra columns are adding , my download button is moving column wise, kindly help me to correct my vba.

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
'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"
             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

End Sub
Avatar of Rgonzo1971
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answers