0

I have the following data:

  • Col a: Specific URL
  • Col b: Number of Pages on that URL

I need to create a list of URL with the appended page value at the end

enter image description here

The end result with excel VBA macro / python should look like this, with the appended &page= value at end.

enter image description here

Vincent Tang
  • 3,758
  • 6
  • 45
  • 63

1 Answers1

0

Answer is this:

Sub Paginator()
    Dim sht As Worksheet: Set sht = ActiveSheet
    Dim LastRow As Long
    Dim curCell As Range
    Dim i As Integer
    Dim iCounter As Integer: iCounter = 0

    LastRow = sht.Cells(Rows.Count, "A").End(xlUp).row

    For Each curCell In sht.Range("A1:A" & LastRow).Cells

        For i = 1 To Val(curCell.Offset(, 1))
            iCounter = iCounter + 1
            Cells(iCounter, 3) = curCell & "&page=" & i
        Next i

    Next    

End Sub

Modify i=2 to ignore page 1 values

enter image description here

Vincent Tang
  • 3,758
  • 6
  • 45
  • 63