#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Web Query

Hi,
I use to get the web data on button click with the codes provided by Dave.
No i would like to modify the codes as per users request. If the innertext
value of 4th column of HTML table is already available in the extracted sheet
then code should skip the row & go for next row of html table something like
if ......... then exit for else. For ready reference some of the codes
provinding here
For Each mRow In mTable.Rows
iCol = 0
For Each mCell In mRow.Cells
rBase.Offset(iRow, iCol).Value = mCell.innerText
iCol = iCol + 1
Next
iRow = iRow + 1
End If
Next

If mCell.innertext value already available then exit for

--
Thanks,
Vikram P. Dhemare
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Web Query


Indexing on the webpage starts at 0 so the 4th column is index 3


For Each mRow In mTable.Rows
if mRow.cells(3) < rBase.Offset(iRow, 4).Value then
iCol = 0
For Each mCell In mRow.Cells
rBase.Offset(iRow, iCol).Value = mCell.innerText
iCol = iCol + 1
Next
iRow = iRow + 1
End If
Next mRow


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

http://www.thecodecage.com/forumz

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Web Query

Thanks Sir,
But I am looking for the answer which can find the HTML Cells(1).innertext
of each row, in a worksheet, if found then go for next HTML row if does not
found then copy the value & paste in that sheet at last filled row.
for Example:
With Wks
iRow = .Range("A" & Rows.Count).End(xlUp).Row
End With
End If
For Each mRow In mTable.Rows
With Wks
Set rngC = Columns(1).Find(What:=mRow.Cells(1).innerText, _
LookAt:=xlPart, LookIn:=xlValues)
End With
If Not rngC Is Nothing Then
Exit For
Else
iCol = 0
For Each mCell In mRow.Cells
rBase.Offset(iRow, iCol).Value = mCell.innerText
iCol = iCol + 1
End If
Next
iRow = iRow + 1
End If
Next mRow

Any help will be highly appreciable.
--
Thanks,
Vikram P. Dhemare


"joel" wrote:


Indexing on the webpage starts at 0 so the 4th column is index 3


For Each mRow In mTable.Rows
if mRow.cells(3) < rBase.Offset(iRow, 4).Value then
iCol = 0
For Each mCell In mRow.Cells
rBase.Offset(iRow, iCol).Value = mCell.innerText
iCol = iCol + 1
Next
iRow = iRow + 1
End If
Next mRow


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

http://www.thecodecage.com/forumz

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Web Query


I ould reverse the procesess you are using. span the webpage then use
find to locate the row and column of the worksheet. Something like
this


For Each mRow In mTable.Rows
ColCount = 0
For Each mCol In mRow
if ColCount = 0 then
RowHeader = mCol
Else
ColHeader = mTable.Rows(0).cells(ColCount)
With Wks
Set rngC = .Columns(1).Find(What:=RowHeader, _
LookAt:=xlPart, LookIn:=xlValues)
if not rngC is nothing then
Set rngR = .Rows(1).Find(What:=ColHeader, _
LookAt:=xlPart, LookIn:=xlValues)
.Cells(rngC.Row,rngR.column) = mCol.innertext
end if
End With
End if
ColCount = ColCount + 1
next mCol
next mRow


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

http://www.thecodecage.com/forumz

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Web Query


Not getting the desired report., Values returns blanks.
--
Thanks,
Vikram P. Dhemare


"Vikram Dhemare" wrote:

Hi,
I use to get the web data on button click with the codes provided by Dave.
No i would like to modify the codes as per users request. If the innertext
value of 4th column of HTML table is already available in the extracted sheet
then code should skip the row & go for next row of html table something like
if ......... then exit for else. For ready reference some of the codes
provinding here
For Each mRow In mTable.Rows
iCol = 0
For Each mCell In mRow.Cells
rBase.Offset(iRow, iCol).Value = mCell.innerText
iCol = iCol + 1
Next
iRow = iRow + 1
End If
Next

If mCell.innertext value already available then exit for

--
Thanks,
Vikram P. Dhemare



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Web Query


Without having access to the webpage and the complete code I can't
dubug the problem for you. I added some message boxes to the code
below. I think your problem may be the row and column headers on the
worksheet don't exactly match the ones on the webpage. You may have
extra spaces, other white characters in the headers ( webpage or
worksheet), or some of the characters may be capitalized. Sometimes
adding a TRIM or forcing all the the to UPPERCASE using the function
UCASE solves these problems.




VBA Code:
--------------------


For Each mRow In mTable.Rows
ColCount = 0
For Each mCol In mRow
if ColCount = 0 then
RowHeader = mCol
Else
ColHeader = mTable.Rows(0).cells(ColCount)
With Wks
Set rngC = .Columns(1).Find(What:=RowHeader, _
LookAt:=xlPart, LookIn:=xlValues)
if not rngC is nothing then
Set rngR = .Rows(1).Find(What:=ColHeader, _
LookAt:=xlPart, LookIn:=xlValues)
if rngR is nothing then
msgbox("Row Header : " & RowHeader & vbcrlf & _
"Column Header : " & ColHeader)
else
.Cells(rngC.Row,rngR.column) = mCol.innertext
end if
else
msgbox("Cannot find row Header : " & RowHeader)
end if
End With
End if
ColCount = ColCount + 1
next mCol
next mRow

--------------------


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

http://www.thecodecage.com/forumz

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
Convert hard coded query criteria to Parameter Query Melanie[_2_] Excel Discussion (Misc queries) 0 July 15th 08 09:59 PM
Excel 2007 / MS Query - editing existing query to another sheet Hotpepperz Excel Discussion (Misc queries) 0 June 13th 08 06:53 PM
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? jocke Excel Discussion (Misc queries) 0 November 28th 05 06:37 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM
Problem with .Background Query option of ODBC Query Shilps Excel Programming 0 April 19th 04 06:41 AM


All times are GMT +1. The time now is 03:50 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"