Q
qitrader888
Using web query, how do i create a macro that will only import a sectio
of the web instead of the entire page. For example, I need to impor
only the current stock data's high, low, close (FEB27) into m
spreadsheet.
Thanks
Here is my code.
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("C3")) Is Nothing Then
Exit Sub
Else
Dim CoSym As String
CoSym = Worksheets("Main").Range("C3").Value
With Sheets("Stock 1").QueryTables(1)
.Connection = _
"URL;http://table.finance.yahoo.com/k?s=" & CoSym
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingAll
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = True
.WebDisableDateRecognition = False
.WebDisableRedirections = True
.Refresh BackgroundQuery:=False
End With
End If
End Su
of the web instead of the entire page. For example, I need to impor
only the current stock data's high, low, close (FEB27) into m
spreadsheet.
Thanks
Here is my code.
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("C3")) Is Nothing Then
Exit Sub
Else
Dim CoSym As String
CoSym = Worksheets("Main").Range("C3").Value
With Sheets("Stock 1").QueryTables(1)
.Connection = _
"URL;http://table.finance.yahoo.com/k?s=" & CoSym
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingAll
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = True
.WebDisableDateRecognition = False
.WebDisableRedirections = True
.Refresh BackgroundQuery:=False
End With
End If
End Su