troubleshooting Question

Need To remove Extra Column adding, while downloading through vba

Avatar of vijay vj
vijay vjFlag for India asked on
Microsoft ExcelVBAMicrosoft Office
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 = ""
             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
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”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.

-Mike Kapnisakis, Warner Bros