download data from internet

tlindeman

Active Member
Joined
Jun 29, 2005
Messages
313
Hello,
I am trying to download a balance sheet form advfn.com. My macro works fine, however, instead of the ticker always being ADM, I need it to be whatever is in cell A1. Please help. Here is my code:
Sheets("Statement of Cash Flows (QTR)").Select
Range("B1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.advfn.com/p.php?pid=financials&btn=istart_date&mode=quarterly_reports&symbol=NYSE%3AADM&istart_date=64" _
, Destination:=Range("$B$1"))
.Name = _
"p.php?pid=financials&btn=istart_date&mode=quarterly_reports&symbol=NYSE%3AADM&istart_date=64"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "20"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
ActiveWindow.SmallScroll Down:=-9
End Sub
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try:-
Code:
[FONT=Courier New][SIZE=1]With ActiveSheet.QueryTables.Add(Connection:= _[/SIZE][/FONT]
[FONT=Courier New][SIZE=1]"URL;http://www.advfn.com/p.php?pid=financials&btn=istart_date&mode=quarterly_reports&symbol=NYSE%3A[B][COLOR=#ff0000]" & Range("A1").Value & "[/COLOR][/B]&istart_date=64" _[/SIZE][/FONT]
[FONT=Courier New][SIZE=1], Destination:=Range("$B$1"))[/SIZE][/FONT]
[FONT=Courier New][SIZE=1].Name = _[/SIZE][/FONT]
[FONT=Courier New][SIZE=1]"p.php?pid=financials&btn=istart_date&mode=quarterly_reports&symbol=NYSE%3A[B][COLOR=#ff0000]" & Range("A1").Value & "[/COLOR][/B]&istart_date=64"[/SIZE][/FONT]
[FONT=Courier New][SIZE=1].FieldNames = True[/SIZE][/FONT]
(Not tested.)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,127
Members
452,381
Latest member
Nova88

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