Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
QueryTable.add naming problem (web query) | Excel Programming | |||
How to obtain the row count of a QueryTable from a Web query | Excel Programming | |||
Problem:Query Cell contain Formula from QueryTable is always get old value | Excel Programming | |||
Excel Web Query using a QueryTable via HTTPS?? | Excel Programming | |||
MS QUERY w/out querytable | Excel Programming |