Greetings!

I am currently working in an automation that will extract values of innertext with common word from all rows. Example is the word "DOWN" is common to all table and I want to extract all the values of the row with the word "DOWN" and extract it to the excel sheet. can you help me by making a vba code that will look up for the word "DOWN" in webpage and then will copy the innertext values before and after the said common word.

see the screenshot for the idea.
nagios.jpg

here is the html codes for the said table.
<TD CLASS='statusHOSTDOWN'><TABLE BORDER=0 WIDTH='100%' cellpadding=0 cellspacing=0>
<TR>
<TD ALIGN=LEFT>
<TABLE BORDER=0 cellpadding=0 cellspacing=0>
<TR>
<TD align=left valign=center CLASS='statusHOSTDOWN'><A HREF='extinfo.cgi?type=1&host=106_sector_31' title='172.18.103.33'>106_sector_31</A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD align=right valign=center>
<TABLE BORDER=0 cellpadding=0 cellspacing=0>
<TR>
<TD ALIGN=center valign=center><A HREF='extinfo.cgi?type=1&host=106_sector_31#comments'><IMG SRC='/nagios/images/comment.gif' BORDER=0 WIDTH=20 HEIGHT=20 ALT='This host has 1 comment associated with it' TITLE='This host has 1 comment associated with it'></A></TD><TD><a href='status.cgi?host=106_sector_31'><img src='/nagios/images/status2.gif' border=0 alt='View Service Details For This Host' title='View Service Details For This Host'></a></TD>
</TR>

</TABLE>
</TD>
</TR>
</TABLE>
</TD>
<TD CLASS='statusHOSTDOWN'>DOWN</TD>
<TD CLASS='statusBGDOWN' nowrap>03-27-2012 16:18:43</TD>
<TD CLASS='statusBGDOWN' nowrap>7d  6h 21m 10s</TD>
<TD CLASS='statusBGDOWN' valign='center'>CRITICAL - Host Unreachable (172.18.103.33)&nbsp;</TD>

</TR>
<TR>
<TD CLASS='statusHOSTDOWN'><TABLE BORDER=0 WIDTH='100%' cellpadding=0 cellspacing=0>
<TR>
<TD ALIGN=LEFT>
<TABLE BORDER=0 cellpadding=0 cellspacing=0>
<TR>
<TD align=left valign=center CLASS='statusHOSTDOWN'><A HREF='extinfo.cgi?type=1&host=191_sector_1' title='172.18.204.3'>191_sector_1</A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD align=right valign=center>
<TABLE BORDER=0 cellpadding=0 cellspacing=0>
<TR>
<TD><a href='status.cgi?host=191_sector_1'><img src='/nagios/images/status2.gif' border=0 alt='View Service Details For This Host' title='View Service Details For This Host'></a></TD>
</TR>

</TABLE>
</TD>
</TR>
</TABLE>
</TD>
<TD CLASS='statusHOSTDOWN'>DOWN</TD>
<TD CLASS='statusBGDOWN' nowrap>03-27-2012 16:18:43</TD>
<TD CLASS='statusBGDOWN' nowrap> 2d  6h  6m 25s</TD>
<TD CLASS='statusBGDOWN' valign='center'>(Host Check Timed Out)&nbsp;</TD>
</TR>
<TR>
<TD CLASS='statusHOSTDOWN'><TABLE BORDER=0 WIDTH='100%' cellpadding=0 cellspacing=0>

<TR>
<TD ALIGN=LEFT>
<TABLE BORDER=0 cellpadding=0 cellspacing=0>
<TR>
<TD align=left valign=center CLASS='statusHOSTDOWN'><A HREF='extinfo.cgi?type=1&host=191_sector_2' title='172.18.204.4'>191_sector_2</A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD align=right valign=center>
<TABLE BORDER=0 cellpadding=0 cellspacing=0>
<TR>
<TD><a href='status.cgi?host=191_sector_2'><img src='/nagios/images/status2.gif' border=0 alt='View Service Details For This Host' title='View Service Details For This Host'></a></TD>
</TR>
</TABLE>
</TD>
</TR>

</TABLE>
</TD>
<TD CLASS='statusHOSTDOWN'>DOWN</TD>
<TD CLASS='statusBGDOWN' nowrap>03-27-2012 16:18:13</TD>
<TD CLASS='statusBGDOWN' nowrap> 2d  6h  5m 27s</TD>
<TD CLASS='statusBGDOWN' valign='center'>(Host Check Timed Out)&nbsp;</TD>
</TR>
<TR>
<TD CLASS='statusHOSTDOWN'><TABLE BORDER=0 WIDTH='100%' cellpadding=0 cellspacing=0>
<TR>
<TD ALIGN=LEFT>
<TABLE BORDER=0 cellpadding=0 cellspacing=0>

<TR>
<TD align=left valign=center CLASS='statusHOSTDOWN'><A HREF='extinfo.cgi?type=1&host=191_sector_3' title='172.18.204.5'>191_sector_3</A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD align=right valign=center>
<TABLE BORDER=0 cellpadding=0 cellspacing=0>
<TR>
<TD><a href='status.cgi?host=191_sector_3'><img src='/nagios/images/status2.gif' border=0 alt='View Service Details For This Host' title='View Service Details For This Host'></a></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
<TD CLASS='statusHOSTDOWN'>DOWN</TD>

<TD CLASS='statusBGDOWN' nowrap>03-27-2012 16:20:42</TD>
<TD CLASS='statusBGDOWN' nowrap> 2d  6h  4m 47s</TD>
<TD CLASS='statusBGDOWN' valign='center'>(Host Check Timed Out)&nbsp;</TD>
</TR>
I want to extract all rows that has the word "DOWN" and then put it in an excel sheet.

I think maybe this code is suitable for extraction, I just don't know how to revise it to match the requirements.

For i = 1 To .document.all.Length
                        If .document.all.Item(i).innertext = "DOWN" Then
                            CSPCells.Offset(0, 1).Value = .document.all.Item(i + 2).innertext
                    Exit For
                        End If
                    Next i
since the table is changing regularly, setting a definite number of this code is not applicable, we just have to provide a code that will extract ALL rows with the word "DOWN", hope you get my idea.