Hi Guys,

Probably best to start by saying I'm a complete Novice at VBA - I normally just stick to handy Excel Functions! But, what I'm trying to do is a little more advanced!

I'm trying to extract data from a webpage using a Macro; but would like to automate the process rather than constantly creating a new Web Query and entering the URL and selecting the table each time ...

So I want Excel to do this:

1) Go to example.com/q=1
2) Copy data from Table 7 into sheet1
3) Go to example.com/q=2
4) Copy data from Table 7 into sheet1 underneith the existing data
5) Go to example.com/q=3 etc etc.
It's pretty straight forward! Now, I know how to create a Macro to visit the webpage etc which is below - but what I don't know is how to use the VBA to manipulate URL Parameters etc

Below is the code I have:
    
Sub extractdatawebsite()
   With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;example.com/" _
        , Destination:=Range("$A$1"))
        .Name = "example.com/"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = "7"
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
End Sub
Can anyone shed some light? Huge thanks in advance!