Loop to stop when a text appears in the sheet

fari1

Active Member
Joined
May 29, 2011
Messages
362
i've a loop code, that stops after the last used cell, i want to modify the code to fit in my scenerio, the thing is that i've a web query that brings in data for a range of data in my column A sheet2, in that column i've no.100,200,300 and so on which trigger my worksheet change in sheet1 and bring in web pages, the only source of stopping that loop is when a page is brought in by web query in my sheet1 column A,which says


HTML:
<h1>No matching filings.<h1>

and this line can be in any row of column A, and i want the loop to stop whenever this line is is shown in the sheet1 column A.

my loop code is


Code:
Sub loopA()
Dim cel As Range
Dim mySheet As Worksheet
 
Set mySheet = Sheets("Wquery")
For Each cel In Sheets("data").Range("A" & Sheets("data").Range("A1").End(xlDown).Row & ":A" & Sheets("data").Range("A" & Rows.Count).End(xlUp).Row)
mySheet.Range("A1") = cel.Value
Next cel

End Sub
</PRE>
</PRE>
 
Last edited:
yes, it did mine as well, the only way to avoid them is to wrape them in html tags, they dont disturb then
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,224,600
Messages
6,179,834
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top