Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to filter the QueryTable from a Web query

I use a Web query to obtain a table from a Web page. Before I put the table
into a range in Excel, how do I filter some rows out (like only keep rows
with the column value greater than 0)? Thanks so much.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to filter the QueryTable from a Web query


The best way is to open an internet explorer application and extract
only the data you want. I can do this if I had the URL. Here is a
simple exabple.

Sub findStock()
StockName = "ibm"
Quant = GetStock(StockName)

End Sub

Function GetStock(ByVal StockName As String)

NoResults = "There are no"

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

URLLOOKUP = "http://finance.yahoo.com/lookup?s="
URL = URLLOOKUP & StockName
TimeOut = False
StartTime = Now
'get web page
IE.Navigate2 URL
Do While IE.readyState < 4 Or _
IE.Busy = True
DoEvents
CurrentTime = Now
If Second(CurrentTime - StartTime) 30 Then
TimeOut = True
GetStock = -1
Exit Do
End If
Loop

If TimeOut = False Then
Set form = IE.document.getElementsByTagName("Form")

Set Results = IE.document.getElementById("yfi_sym_results")

If Left(Results.innertext, Len(NoResults)) = NoResults Then
GetStock = 0
Else
Set Quantity = IE.document.getElementById("yfi_sym_lookup")
Text = Quantity.innertext
'get number from parenthesis
Quant = Mid(Text, InStr(Text, "(") + 1)
Quant = Val(Quant)
GetStock = Quant
End If
End If

IE.Quit


End Function


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=160569

Microsoft Office Help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default How to filter the QueryTable from a Web query

If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Felix_Jiang" wrote in message
...
I use a Web query to obtain a table from a Web page. Before I put the table
into a range in Excel, how do I filter some rows out (like only keep rows
with the column value greater than 0)? Thanks so much.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
QueryTable.add naming problem (web query) PeacefulAnd4getful Excel Programming 2 August 27th 10 08:30 AM
How to obtain the row count of a QueryTable from a Web query Felix_Jiang Excel Programming 4 December 8th 09 03:32 PM
Problem:Query Cell contain Formula from QueryTable is always get old value Resant Excel Programming 1 March 3rd 06 07:28 AM
Excel Web Query using a QueryTable via HTTPS?? Bing Excel Programming 2 April 2nd 05 03:51 PM
MS QUERY w/out querytable No Name Excel Programming 1 October 24th 03 03:55 PM


All times are GMT +1. The time now is 08:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"