Need to start code from a certain point

Sharid

Well-known Member
Joined
Apr 22, 2007
Messages
1,066
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
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]URLS[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]https://www.mysite.com[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]https://www.thissite.co.uk[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]https://www.yoursite.com[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]https://www.supersite.co.uk[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]https://www.funsite.com[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]https://www.bestsite.com[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]https://www.helpfulsite.com[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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,224,748
Messages
6,180,721
Members
452,995
Latest member
isldboy

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