kanbear11 0 Newbie Poster

Hi so i need to pull info from a web page and i want to rotate through a list of stock codes.

sheet 1 contains a list of companies stock codes starting at cell "a9" including rloc, dis, wmt.

Basically I'm going to have a macro that pulls the web query from yahoo. pulls the stock price places it next to the stock code on sheet 1. Then it will delete the query and input the next stock code on the list and pull the data all over again.

When I put in the variable....

Sheet1.Range("A9").Value

It is giving me a runtime error 424 object not located ...

here is the original website with the first stock code...
http://finance.yahoo.com/search?p=rloc

Here is the code that I am having the problem...
Sub Macro6()
'
' Macro6 Macro
'

'
With Sheet3.QueryTables.Add(Connection:= _
"URL;http://finance.yahoo.com/search?p=" & Sheet1.Range("A9").Value, Destination:=Range("$A$1"))
.Name = "search?p=rloc"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
ActiveWindow.SmallScroll Down:=29
Columns("A:A").ColumnWidth = 20.71
Range("A66").Select
Selection.Copy
Sheets("Sheet1").Select
Range("B9").Select
ActiveSheet.Paste
Sheets("Sheet3").Select
ActiveWindow.ScrollRow = 52
ActiveWindow.ScrollRow = 44
ActiveWindow.ScrollRow = 28
ActiveWindow.ScrollRow = 15
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 1
Cells.Select
Application.CutCopyMode = False
Selection.QueryTable.Delete
Selection.ClearContents
Range("A1").Select
End Sub

Thank you again for your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.