Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Many people that visit this Discussion Group have provided me with help in
the past; I am hoping someone can help me out once more. I have been battling this problem for quite some time now. I have a long list of stock symbols (106 total, all in ColumnD). I am wondering if there is a way to loop through the entire array and copy/paste each value into a certain section of a VBA macro that I recorded to get daily stock prices from the Yahoo finance web site. Again, am trying to get the code to start in Cell D2 (for instance) recognize that the value is KFT (for Kraft Foods Inc.), copy/paste this value into the snippet of code into the "KFT" spot below: "URL;http://finance.yahoo.com/q/hp?s=KFT&a=00&b=1&c=2007&d=02&e=14&f=2007&g=d" _ Below is my full macro: Sub HistoricalData() 'KFT - Historical Data Sheets("KFT").Select Cells.Select Range("A1:IJ50000").ClearContents With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://finance.yahoo.com/q/hp?s=KFT&a=00&b=1&c=2007&d=02&e=14&f=2007&g=d" _ , Destination:=Range("A1")) .Name = "hp?s=KFT&a=00&b=1&c=2007&d=02&e=14&f=2007&g=d " .FieldNames = True .RowNumbers = False .WebTables = "20" .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = False .WebDisableDateRecognition = False .WebDisableRedirections = False .Refresh BackgroundQuery:=False End With Columns("A:A").ColumnWidth = 11.14 Cells.Select With Selection .MergeCells = False End With Range("A1").Select Range("B:D,F:G").Select Range("F1").Activate Selection.Delete shift:=xlToLeft Range("A1").Select End Sub Ive seen Excel do some pretty AMAZING things over the years. Not sure if Excel can handle this task or not, but it would be awesome if it could!! Regards RyGuy--- |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy paste loop---new to vba | Excel Programming | |||
Copy and Paste using a loop | Excel Programming | |||
Creating Loop to Paste Array | Excel Programming | |||
Copy/Paste Loop | Excel Programming | |||
Excel VBA, Loop, array, cut and paste | Excel Programming |