Hi,
I have a problem with my table. Everything is in one column
Module:
Sub GetStockIncome(ByVal destination As String, ByVal sheetprint As String, ByVal cellprint As String, ByVal cellprintend As String)
'
' GetStockIncome Macro
' Macro to get Income statement
'
' Keyboard Shortcut: Ctrl+g
'
'
Dim Symbol As String
'Settings the right sheet
Symbol = Sheets("Parametres").Range("ticker").Value
Sheets("Fundamental").Select
Dim QuerySheet As Worksheet
Dim DataSheet As Worksheet
Dim qurl As String
Dim i As Integer
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlCalculationManual
Set DataSheet = ActiveSheet
'
' Clear part of column E and build Yahoo download URL using contents of column A.
'
qurl = "http://financials.morningstar.com/ajax/ReportProcess4CSV.html?t=" & Symbol & "®ion=USA&culture=en_us&reportType=" & sheetprint & "&period=12&dataType=A&order=asc&columnYear=5&rounding=3&view=raw"
'
' Display request URL (if uncommented).
'
' Range("c41") = qurl
'
' Request URL data be loaded to Column E
'
QueryQuote:
With ActiveSheet.QueryTables.Add(Connection:="URL;" & qurl, destination:=DataSheet.Range("" & cellprint & ""))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With
Range("" & cellprint & ":" & cellprintend & "").TextToColumns destination:=Range("" & cellprint & ":" & cellprintend & ""), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=True, Space:=False, other:=False
'
' Turn calculation back on
'
'Application.Calculation = xlCalculationAutomatic
'Application.DisplayAlerts = True
'
'Range("A1").Select
End Sub
The code:
Call GetStockIncome("Fundamental", "is", "$A$1", "$A$27")
Bookmarks