error in VBA code

Geronimo9791

New Member
Joined
Nov 25, 2013
Messages
2
hi all,

see below the VBA code I programmed (new at this). The debugger gets always stuck on the same line highlighted in red. It's probably something stupid but I'm not seeing it. thx in advance for the help

regards


Sub GetOne()
' Download one stock only

Dim QuerySheet As Worksheet
Dim DataSheet As Worksheet
Dim EndDate As Date
Dim StartDate As Date
Dim Symbol As String
Dim qurl As String
Dim nQuery As Name
Dim i As Integer

Application.ScreenUpdating = True
Application.DisplayAlerts = False
Application.Calculation = xlCalculationAutomatic

Set DataSheet = ActiveSheet

StartDate = DataSheet.Range("I1").Value
EndDate = DataSheet.Range("I2").Value
Symbol = DataSheet.Range("G1").Value
Range("L1").CurrentRegion.ClearContents

'construct the URL for the query

qurl = "http://ichart.finance.yahoo.com/table.csv?s=" & Symbol
qurl = qurl & "&a=" & Month(StartDate) - 1 & "&b=" & Day(StartDate) & _
"&c=" & Year(StartDate) & "&d=" & Month(EndDate) - 1 & "&e=" & _
Day(EndDate) & "&f=" & Year(EndDate) & "&g=d" & Range("C4") & "&ignore=.csv"

QueryQuote:
With ActiveSheet.QueryTables.Add(Connection:="URL;" & qurl, Destination:=DataSheet.Range("L1"))

.BackgroundQuery = True
.TablesOnlyFromHTML = False
.QueryTable.Refresh BackgroundQuery:=False
.SaveData = True
End With

Range("L1").CurrentRegion.TextToColumns Destination:=Range("L1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=True, Space:=False, other:=False

Columns("L:R").Select
Selection.ColumnWidth = 8

Application.DisplayAlerts = True

RemoveNames

Range("A1").Select

End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,203,483
Messages
6,055,673
Members
444,807
Latest member
RustyExcel

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