Need to start code from a certain point

Sharid

Well-known Member
Joined
Apr 22, 2007
Messages
1,064
Office Version
  1. 2016
Platform
  1. Windows
Hi

In my workbook I have two sheets

Sheet1 = "Scraper"
Sheet2 = "Url List"

In Sheet 2 Column "A" Row 2 I have a list of URLs, every time one has been processed my code place a NUMBER "1" in column B next blank row.

The number "1" have two purposes, one as a counter and two to indicate that the this cell has been processed. What I need is for my code to ONLY run on urls that do not have the number 1 in column B sheet2

Sheet2
URLS3
https://www.mysite.com1
https://www.thissite.co.uk1
https://www.yoursite.com1
https://www.supersite.co.uk
https://www.funsite.com
https://www.bestsite.com
https://www.helpfulsite.com

<tbody>
</tbody>

In the above example the first 3 urls have been processed, therefore when the code is run again it will start from the 4th url https://www.supersite.co.uk

Something like an IF Statement e.g.

IF Sheet2. "Url List" column "B" = "" then

MY CODE HERE


Else

IF Sheet2. "Url List" column "B" = 1 then

Start my code from here

If There are NO urls left to process then message box "Process completed, there is nothing to process"

Thanks
 
Last edited:

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Try this

Code:
Sub test5()
    Dim sh2 As Worksheet
    Set sh2 = Sheets("Url List")
    For i = 2 To sh2.Range("A" & Rows.Count).End(xlUp).Row
        If sh2.Cells(i, "B").Value = "" Then
            'MY CODE HERE
        
        ElseIf sh2.Cells(i, "B").Value = 1 Then
            'Start my code from here
            
        End If
    Next
    MsgBox "Process completed, there is nothing to process"
End Sub
 
Upvote 0
Sharid,
You appear to be suggesting that the URLs will be processed sequentially?
Your code must currently be starting the process with reference to say Cell A2 or Row 2 ?
You can maybe alter that to be A2 or Row2 , OFFSET by the total you have in B1 ?

Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,214,592
Messages
6,120,433
Members
448,961
Latest member
nzskater

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