Wow thanks a lot... I'm running it now I would've never been able to write this entire code myself. This was my code for which I found by using the macro recorder: Sub ImportingWebData() ' ' ImportingWebData Macro ' Importing Web Data ' ' Keyboard Shortcut: Ctrl+Shift+D ' With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://www.google.com/finance?q=spy", Destination:=Range("$A$1")) .Name = "finance?q=spy" .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 = """md""" .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = False .WebDisableDateRecognition = False .WebDisableRedirections = False .Refresh BackgroundQuery:=False End With End Sub
Here are DTrader98 findings from the macro recorder: Sub Refresh_Query() Sheets("Sheet1").Activate Range("a1").Select Selection.QueryTable.Refresh BackgroundQuery:=True Start_Timer Dim qt As QueryTable For Each qt In ActiveSheet.QueryTables qt.Refresh BackgroundQuery:=False Next Range("A1").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet2").Select Range("A" & i).Select ActiveSheet.Paste Sheets("Sheet1").Select Range("A1").Select i = i + 1 End Sub ************************** Sub Refresh_Query() Sheets("Sheet1").Activate Range("a1").Select Selection.QueryTable.Refresh BackgroundQuery:=True Start_Timer Static i As Integer Selection.Copy Sheets("Sheet2").Select Range("A" & i + 1).Select ActiveSheet.Paste Sheets("Sheet1").Select Range("A1").Select i = i + 1 Dim qt As QueryTable For Each qt In ActiveSheet.QueryTables qt.Refresh BackgroundQuery:=False Next End Sub
Thanks GTG and DTrader98... I'm going to run both codes tomorrow and will post the results on the thread.
Yes, there is Excel VBA code to save the first quote of say "SPY" to cell D1 & "USO" into cell E1 ... then save the next quote 1 second or 10 seconds or whatever X seconds later to cell D2 and E2... etc.. all the way out to whatever cell... or you can do it vertically rather than horizontally... Pretty straight forward... You can even save the data to a TXT file or to an Access database.. etc... ...
Google quotes are real-time for NYSE, NASDAQ, AMEX listings (provided by BATS ecn)... When I develop the other workbooks for my overall strategy, I will subscribe to a more professional data feed. EdgeHunter mentioned that I could get quotes for ~$20 so I may get the feed very soon. Earlier I assumed that I would have to pay NYSE and NASDAQ ~$200 a month each. Glad to see that I was wrong. Fortunately I just need Level I.
I sent an e-mail to their sales department earlier tonight. Had a couple of questions. Looking forward to hearing from them tomorrow. It would be a big relief if I don't have to cough up $350 a month. I don't need Level II for my system.
What portion of this code generates the random numbers and how do i replace that part of the code to read active stock prices? the cell formula for active pricing is =RTD("tos.rtd", , "LAST", A1) with A1 being the ticker symbol
I love someone using search! I'm not sure how to do it that way. When I do that, I use the application on time now + time. should be easy enough to find. I record a macro to insert a line, moving all previous data down and paste values the new data. I hope that helps.