Cannot pull table from different tabs within the same webpage.

mj sachoo

New Member
Joined
Nov 18, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am trying to obtain the data table from website. However, I can only extract the data from the 'Price' tab.

1605753640023.png


I cannot obtain the tables under the 'Performance', 'Technical and 'Fundamental Tabs.

I get the following error when trying to click the other tabs:

1605753837311.png


I do not know how to get these tables from other tabs.

Last hope is this website as I have not got anything from other forums or websites.

Please advise.

Thanks
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Try the following approach with macros:

In a standard vba module insert this code:
Code:
Sub GetTabbbSub(ByVal myURL As String)
'See http://www.pc-facile.com/forum/viewtopic.php?f=26&t=105843#p619587
Set IE = CreateObject("InternetExplorer.Application")
   
With IE
    .navigate myURL
    .Visible = True
Stop                '*** VEDI Testo
    Do While .Busy: DoEvents: Loop    'Attesa not busy
    Do While .readyState <> 4: DoEvents: Loop 'Attesa documento
End With
'
myStart = Timer  'attesa addizionale
Do
    DoEvents
    If Timer > myStart + 1 Or Timer < myStart Then Exit Do
Loop

'Write table values on the active sheet:
Set myColl = IE.document.getElementsByTagName("TABLE")
For Each myItm In myColl
    Cells(I + 1, 1) = "Table# " & ti + 1
    ti = ti + 1: I = I + 1
    For Each trtr In myItm.Rows
        For Each tdtd In trtr.Cells
            Cells(I + 1, j + 1) = tdtd.innerText
            j = j + 1
        Next tdtd
        I = I + 1: j = 0
DoEvents
    Next trtr

I = I + 1
Next myItm
'
'Chiusura IE
IE.Quit
Set IE = Nothing
End Sub

Then add this macro:
Code:
Sub Call1()
    Sheets("Foglio1").Select       '<<< The sheet that will be loaded
    Cells.ClearContents            'NB: that sheet will be creared!!
    Call GetTabbbSub("https://au.investing.com/equities/australia")     '<<< Your Url
    Cells.WrapText = False
End Sub
The lines marked <<< need to be configured according your situation

Then start Sub Call1; it will open a I.E. session, open the web page and extract from the page all the available tables, ie the html structures presented as <table>

Bye
 
Upvote 0
Try the following approach with macros:

In a standard vba module insert this code:
Code:
Sub GetTabbbSub(ByVal myURL As String)
'See http://www.pc-facile.com/forum/viewtopic.php?f=26&t=105843#p619587
Set IE = CreateObject("InternetExplorer.Application")
  
With IE
    .navigate myURL
    .Visible = True
Stop                '*** VEDI Testo
    Do While .Busy: DoEvents: Loop    'Attesa not busy
    Do While .readyState <> 4: DoEvents: Loop 'Attesa documento
End With
'
myStart = Timer  'attesa addizionale
Do
    DoEvents
    If Timer > myStart + 1 Or Timer < myStart Then Exit Do
Loop

'Write table values on the active sheet:
Set myColl = IE.document.getElementsByTagName("TABLE")
For Each myItm In myColl
    Cells(I + 1, 1) = "Table# " & ti + 1
    ti = ti + 1: I = I + 1
    For Each trtr In myItm.Rows
        For Each tdtd In trtr.Cells
            Cells(I + 1, j + 1) = tdtd.innerText
            j = j + 1
        Next tdtd
        I = I + 1: j = 0
DoEvents
    Next trtr

I = I + 1
Next myItm
'
'Chiusura IE
IE.Quit
Set IE = Nothing
End Sub

Then add this macro:
Code:
Sub Call1()
    Sheets("Foglio1").Select       '<<< The sheet that will be loaded
    Cells.ClearContents            'NB: that sheet will be creared!!
    Call GetTabbbSub("https://au.investing.com/equities/australia")     '<<< Your Url
    Cells.WrapText = False
End Sub
The lines marked <<< need to be configured according your situation

Then start Sub Call1; it will open a I.E. session, open the web page and extract from the page all the available tables, ie the html structures presented as <table>

Bye



Thank you very much for your response.

I managed to run the macro and export the table from the IE to excel.

For the first tab "price", ther was no issues and it was extracted just like it could be pulled via the normal extract from web funtionality in Excel.

1605783951102.png


The moment, I tried extracting from "Performance", "Technical" and "Fundamental" tabs, I got the following error:

1605783915945.png



1605783999277.png



I guess it has something to do with javascript:void(0); when checking the inspect element href.

Any ideas why this is happening?

Thank you :)
 
Upvote 0
I inserted a "Stop" in the code, but then forgot to mention how to deal with it...

First, since the web page is javascript based the traditional web query approach is unreliable; so when you use it you may get good results or bad results.
That's why my proposal is based on code that inspect the html of the page and get the table rows and columns information.

The "Stop"...
It stops the macro after opening the webpage with the default information. If you are ok with that then you "continue" the excecution of the macro and the tables will be collected.
If you need to get data fron a different "tab" then, working on the IE session, you select the right tab, then go to the vba environment a continue the macro to get the data from this different tab; you can even (before continuing macro execution) select a different sheet to be used for this datas.

Of course the macro could select tabs via code, if it is clear which tabs need to be collected on which worksheets

Bye
 
Upvote 0
I inserted a "Stop" in the code, but then forgot to mention how to deal with it...

First, since the web page is javascript based the traditional web query approach is unreliable; so when you use it you may get good results or bad results.
That's why my proposal is based on code that inspect the html of the page and get the table rows and columns information.

The "Stop"...
It stops the macro after opening the webpage with the default information. If you are ok with that then you "continue" the excecution of the macro and the tables will be collected.
If you need to get data fron a different "tab" then, working on the IE session, you select the right tab, then go to the vba environment a continue the macro to get the data from this different tab; you can even (before continuing macro execution) select a different sheet to be used for this datas.

Of course the macro could select tabs via code, if it is clear which tabs need to be collected on which worksheets

Bye


Thank you Anthony for clarifying the stop function. I think this is the furthest I have gone thanks to your help.

I did get the same error message as above and the IE closed, but the sheet populated the other tab's table.

However, it came in as a text and not as a live table which can be refreshed from the link.

Thank you
 
Upvote 0
If you need a continuous refresh then you have to schedule, using the vba method "OnTime" replaying Sub Call1 every XX minutes.
Of course this timed rescheduling is not compatible with the "Stop and Choose" approach...
So I shall try to develop a Sub CallAll that will read (on the same worksheet? On 4 different worksheets?) all the 4 tabs (do you need the 4 tabs?)

I did get the same error message as above and the IE closed, but the sheet populated the other tab's table.
I didnt get any error while importing one after the other the 4 tabs' tables; my IE version is 11
In case you get an error that require user attention, for example clicking something, the automatic resheduling of the (future) Sub CallAll would be useless.
I shall update the thread when this Sub CallAll would be ready, but in the meantime you should clarify the questions I rise before

Bye
 
Upvote 0
Worf's message, above, reminded me that I had promised an additional version of code, that allowed getting the table from each of the selectors available at the home page of the site (even though I asked MJ SACHOO for some clarifications).

The new code, to be copied into an empty standard vba module of the workbook to be compiled:

Code:
#If VBA7 Then        'STRICTLY ON TOP OF A STANDARD MODULE
    Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr)
    Declare PtrSafe Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdSHow As Long) As LongPtr
#Else
    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdSHow As Long) As Long
#End If
Dim mmTB As Long, mmTR As Long, mmTD As Long


Sub GetTablesAUSt(ByRef ISh As Worksheet, ByVal myURL As String, _
  Optional ByVal TabInd As Long = 1, _
  Optional ByVal ClearSh As Boolean = False)
'See pc-facile • Estrazione dati dal sito dinamico
Dim TabArr, TabTo As Long, IJ As Long, IE As Object, myColl As Object, myItm As Object
Dim I As Long, J As Long, TI As Long, KK As Long, cCL As Long, LastR As Long
Dim FlInfo As Boolean, Rispo, GloMess As String, TabDone As Long
'
FlInfo = True              'or FALSE to avoid poput at runtime
'
'Popup message at runtime?
If FlInfo Then
On Error Resume Next
    GloMess = "Starting updating AUL Stock Info"
    Rispo = Shell("mshta.exe vbscript:close(CreateObject(""WScript.Shell"").Popup(""" & GloMess & """,7,""Information:"",64))")
On Error GoTo 0
End If
Debug.Print ">>> " & myURL & " - " & Format(Now, "hh:mm:ss")
Debug.Print ISh.Name, TabInd, ClearSh
Set IE = CreateObject("InternetExplorer.Application")
Debug.Print Timer
With IE
    .navigate myURL                         'Navigate to the page
    ShowWindow IE.hwnd, 2                   'Minimize, for Scheduled excecution compatibility
    .Visible = True
    Do While .Busy
'        DoEvents: DoEvents
    Loop                                    'Attesa not busy
    Debug.Print Timer
    Do While .readyState <> 4
'       DoEvents
    Loop                                    'Attesa document
End With
'
Debug.Print Timer
Sleep 200
'Select tab
TabArr = Array("filter_price", "filter_performance", "filter_technical", "filter_fundamental")
If TabInd = 0 Then TabTo = 4 Else TabTo = TabInd
For IJ = TabInd To TabTo                            'Scan requested Tabs
    mmTB = 0: mmTR = 0: mmTD = 0
    If ClearSh Then ISh.Cells.ClearContents         'Clear sheet, if requested
    If IJ = 0 Then IJ = 1
    IE.document.getelementbyid(TabArr(IJ - 1)).Click
    Debug.Print TabArr(IJ - 1) & " - " & Format(Now, "hh:mm:ss")
    'Popup message at runtime?
    If FlInfo Then
    On Error Resume Next
        GloMess = "Importing " & TabArr(IJ - 1)
        Rispo = Shell("mshta.exe vbscript:close(CreateObject(""WScript.Shell"").Popup(""" & GloMess & """,3,""Information:"",64))")
    On Error GoTo 0
    End If
    '
    Sleep 100
    For KK = 1 To 30            'Max 6 secs wait
        Set myColl = IE.document.GETelementsbytagname("tr")
        Debug.Print myColl.Length, IJ
        If cCL = myColl.Length And cCL > 100 Then Exit For
        cCL = myColl.Length
        Sleep 300
    Next KK
    'Get last used row on destination sheet
    LastR = 0
    On Error Resume Next
        LastR = ISh.Cells.Find("*", ISh.Range("A1"), xlValues, , xlByRows, xlPrevious).Row
        Debug.Print "LastR=" & LastR
    On Error GoTo 0
    I = LastR: J = 0: TI = 0
    'Write table values on the active sheet:
    Set myColl = IE.document.GETelementsbytagname("TABLE")
    For Each myItm In myColl                    'Scan Available TABLES
        mmTB = mmTB + 1: mmTR = 0: mmTD = 0

        ISh.Cells(I + 1, 1) = "Table# " & TI + 1
        TI = TI + 1: I = I + 1
        For Each trtr In myItm.Rows             'Scan available rows
            mmTR = mmTR + 1
            For Each tdtd In trtr.Cells         'Scan available cells
                mmTD = mmTD + 1
                ISh.Cells(I + 1, J + 1) = tdtd.innerText
                J = J + 1
            Next tdtd
            I = I + 1: J = 0
'    DoEvents
        Next trtr
           
        I = I + 1
        Debug.Print "MM??", mmTB, mmTR, mmTD
        If TabDone > 0 Then Exit For
    Next myItm
   
    If ISh.Index < ThisWorkbook.Sheets.Count Then
        Set ISh = ThisWorkbook.Sheets(ISh.Index + 1)
    End If
    TabDone = TabDone + 1
Next IJ
If FlInfo Then
On Error Resume Next
    Debug.Print "Completed" & " - " & Format(Now, "hh:mm:ss")
    GloMess = "Completed AUL Stock Info"
    Rispo = Shell("mshta.exe vbscript:close(CreateObject(""WScript.Shell"").Popup(""" & GloMess & """,1,""Information:"",64))")
On Error GoTo 0
End If
'
'Chiusura IE

IE.Quit
Debug.Print "Quit"
Set IE = Nothing
Debug.Print "--------------------------END"
End Sub

This is a subroutine that has to be recalled from a main macro, that must "pass" the following parametres:
a) the sheet where the Tables will be loaded, as Worksheet
b) the url of the destination site, as String; the code is pecialized for the AUL Stock market, the only valid parametre is Australia Stock Market - Investing.com AU
c) the site "Tab number" to be imported, as Long. 0 means "all the tabs", 1 means the "Price" tab, 2 means the "Performance" tab, on so on with 3 and 4
So the same code can import either one or four set of tables (each "set" includes all the tables in a Tab).
Since my choice was that each Tab will be imported in its own worksheet, the parametre passed in a) means "the first worksheet where the first set of tables will be loaded"; the "next" tab (if the choice is 0=all the 4 tabs) will be imported into the "next" sheet: next means the one whose tab is at right of the current sheet. Beware of this. Also, in case that there is not a "next" sheet then the current one will be used again for the subsequent set of tables.
d) Clear sheet before importing, as Boolean. If True then the sheet will be first cleared then updated values will be imported; if False then new values will be appended to the existing ones

Parametres c) and d) are optional, and their default values are 1 (import only Price tab) and False (do not clear, but append new values)

As said, the above subroutine need to be called from a main macro. For my tests I used:
Code:
Sub CallAUStock()
    Call GetTablesAUSt(ThisWorkbook.Sheets("Foglio1"), "https://au.investing.com/equities/australia", 0, True) '<<< Your Url
    ThisWorkbook.Sheets("Foglio1").Range("A:Z").WrapText = False
End Sub
This will load into Foglio1 and the "next" 3 sheets the four set of tables available on the 4 Tabs.
HOWEVER each tab contains one specific , long, table and 8 other tables that don't change when switching from tab Price to other tabs. Therefore the full set of tables will be collected only on the first tab imported (either the Price tab, if 1 or 0 is selected in parametre C; or the choosed single tab)
The macro CallAUStock can be excecuted time by time to refresh the stock values; it is therefore important that the sheet passed as parametre a) belongs to "ThisWorksheet" (ie the worksheet that hosts the macro), otherwise "current workbook" would be used; that's why in my CallAUStock I used ThisWorkbook.Sheets("MySheet").
However the macro takes several seconds to be completed, and during this time excel become unusable; I was not able to cut the excecution time, as most of the delay occours (in my testing) before the "IE Document" be declared "completed" (ie the page has been fully assembled). So I don't know how practical is rescheduling it (using the OnTime method) every N minutes.
To make aware the user of what is going on I created some pop-up messages that should appear in foreground, that disapper after few second and anywhay that don't interfere with other applications (excel is frozen during the macro excecution)

The code indeed contains several "DoEvents" that were intended to prevent this freeze, but then I realized that macros (any macro) just abort its flow as soon Excel enter the Edit Mode, i.e. when you type from the keyboard, or delete or anyway you edit cells. So eventually I removed (or better: "I commented") the DoEvents instruction to make sure the macro be completed.

In conclusion, I am afraid that what I got is working prototype rather then a finished product

Bye
 
Upvote 0
Worf's message, above, reminded me that I had promised an additional version of code, that allowed getting the table from each of the selectors available at the home page of the site (even though I asked MJ SACHOO for some clarifications).

The new code, to be copied into an empty standard vba module of the workbook to be compiled:

Code:
#If VBA7 Then        'STRICTLY ON TOP OF A STANDARD MODULE
    Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr)
    Declare PtrSafe Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdSHow As Long) As LongPtr
#Else
    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdSHow As Long) As Long
#End If
Dim mmTB As Long, mmTR As Long, mmTD As Long


Sub GetTablesAUSt(ByRef ISh As Worksheet, ByVal myURL As String, _
  Optional ByVal TabInd As Long = 1, _
  Optional ByVal ClearSh As Boolean = False)
'See pc-facile • Estrazione dati dal sito dinamico
Dim TabArr, TabTo As Long, IJ As Long, IE As Object, myColl As Object, myItm As Object
Dim I As Long, J As Long, TI As Long, KK As Long, cCL As Long, LastR As Long
Dim FlInfo As Boolean, Rispo, GloMess As String, TabDone As Long
'
FlInfo = True              'or FALSE to avoid poput at runtime
'
'Popup message at runtime?
If FlInfo Then
On Error Resume Next
    GloMess = "Starting updating AUL Stock Info"
    Rispo = Shell("mshta.exe vbscript:close(CreateObject(""WScript.Shell"").Popup(""" & GloMess & """,7,""Information:"",64))")
On Error GoTo 0
End If
Debug.Print ">>> " & myURL & " - " & Format(Now, "hh:mm:ss")
Debug.Print ISh.Name, TabInd, ClearSh
Set IE = CreateObject("InternetExplorer.Application")
Debug.Print Timer
With IE
    .navigate myURL                         'Navigate to the page
    ShowWindow IE.hwnd, 2                   'Minimize, for Scheduled excecution compatibility
    .Visible = True
    Do While .Busy
'        DoEvents: DoEvents
    Loop                                    'Attesa not busy
    Debug.Print Timer
    Do While .readyState <> 4
'       DoEvents
    Loop                                    'Attesa document
End With
'
Debug.Print Timer
Sleep 200
'Select tab
TabArr = Array("filter_price", "filter_performance", "filter_technical", "filter_fundamental")
If TabInd = 0 Then TabTo = 4 Else TabTo = TabInd
For IJ = TabInd To TabTo                            'Scan requested Tabs
    mmTB = 0: mmTR = 0: mmTD = 0
    If ClearSh Then ISh.Cells.ClearContents         'Clear sheet, if requested
    If IJ = 0 Then IJ = 1
    IE.document.getelementbyid(TabArr(IJ - 1)).Click
    Debug.Print TabArr(IJ - 1) & " - " & Format(Now, "hh:mm:ss")
    'Popup message at runtime?
    If FlInfo Then
    On Error Resume Next
        GloMess = "Importing " & TabArr(IJ - 1)
        Rispo = Shell("mshta.exe vbscript:close(CreateObject(""WScript.Shell"").Popup(""" & GloMess & """,3,""Information:"",64))")
    On Error GoTo 0
    End If
    '
    Sleep 100
    For KK = 1 To 30            'Max 6 secs wait
        Set myColl = IE.document.GETelementsbytagname("tr")
        Debug.Print myColl.Length, IJ
        If cCL = myColl.Length And cCL > 100 Then Exit For
        cCL = myColl.Length
        Sleep 300
    Next KK
    'Get last used row on destination sheet
    LastR = 0
    On Error Resume Next
        LastR = ISh.Cells.Find("*", ISh.Range("A1"), xlValues, , xlByRows, xlPrevious).Row
        Debug.Print "LastR=" & LastR
    On Error GoTo 0
    I = LastR: J = 0: TI = 0
    'Write table values on the active sheet:
    Set myColl = IE.document.GETelementsbytagname("TABLE")
    For Each myItm In myColl                    'Scan Available TABLES
        mmTB = mmTB + 1: mmTR = 0: mmTD = 0

        ISh.Cells(I + 1, 1) = "Table# " & TI + 1
        TI = TI + 1: I = I + 1
        For Each trtr In myItm.Rows             'Scan available rows
            mmTR = mmTR + 1
            For Each tdtd In trtr.Cells         'Scan available cells
                mmTD = mmTD + 1
                ISh.Cells(I + 1, J + 1) = tdtd.innerText
                J = J + 1
            Next tdtd
            I = I + 1: J = 0
'    DoEvents
        Next trtr
          
        I = I + 1
        Debug.Print "MM??", mmTB, mmTR, mmTD
        If TabDone > 0 Then Exit For
    Next myItm
  
    If ISh.Index < ThisWorkbook.Sheets.Count Then
        Set ISh = ThisWorkbook.Sheets(ISh.Index + 1)
    End If
    TabDone = TabDone + 1
Next IJ
If FlInfo Then
On Error Resume Next
    Debug.Print "Completed" & " - " & Format(Now, "hh:mm:ss")
    GloMess = "Completed AUL Stock Info"
    Rispo = Shell("mshta.exe vbscript:close(CreateObject(""WScript.Shell"").Popup(""" & GloMess & """,1,""Information:"",64))")
On Error GoTo 0
End If
'
'Chiusura IE

IE.Quit
Debug.Print "Quit"
Set IE = Nothing
Debug.Print "--------------------------END"
End Sub

This is a subroutine that has to be recalled from a main macro, that must "pass" the following parametres:
a) the sheet where the Tables will be loaded, as Worksheet
b) the url of the destination site, as String; the code is pecialized for the AUL Stock market, the only valid parametre is Australia Stock Market - Investing.com AU
c) the site "Tab number" to be imported, as Long. 0 means "all the tabs", 1 means the "Price" tab, 2 means the "Performance" tab, on so on with 3 and 4
So the same code can import either one or four set of tables (each "set" includes all the tables in a Tab).
Since my choice was that each Tab will be imported in its own worksheet, the parametre passed in a) means "the first worksheet where the first set of tables will be loaded"; the "next" tab (if the choice is 0=all the 4 tabs) will be imported into the "next" sheet: next means the one whose tab is at right of the current sheet. Beware of this. Also, in case that there is not a "next" sheet then the current one will be used again for the subsequent set of tables.
d) Clear sheet before importing, as Boolean. If True then the sheet will be first cleared then updated values will be imported; if False then new values will be appended to the existing ones

Parametres c) and d) are optional, and their default values are 1 (import only Price tab) and False (do not clear, but append new values)

As said, the above subroutine need to be called from a main macro. For my tests I used:
Code:
Sub CallAUStock()
    Call GetTablesAUSt(ThisWorkbook.Sheets("Foglio1"), "https://au.investing.com/equities/australia", 0, True) '<<< Your Url
    ThisWorkbook.Sheets("Foglio1").Range("A:Z").WrapText = False
End Sub
This will load into Foglio1 and the "next" 3 sheets the four set of tables available on the 4 Tabs.
HOWEVER each tab contains one specific , long, table and 8 other tables that don't change when switching from tab Price to other tabs. Therefore the full set of tables will be collected only on the first tab imported (either the Price tab, if 1 or 0 is selected in parametre C; or the choosed single tab)
The macro CallAUStock can be excecuted time by time to refresh the stock values; it is therefore important that the sheet passed as parametre a) belongs to "ThisWorksheet" (ie the worksheet that hosts the macro), otherwise "current workbook" would be used; that's why in my CallAUStock I used ThisWorkbook.Sheets("MySheet").
However the macro takes several seconds to be completed, and during this time excel become unusable; I was not able to cut the excecution time, as most of the delay occours (in my testing) before the "IE Document" be declared "completed" (ie the page has been fully assembled). So I don't know how practical is rescheduling it (using the OnTime method) every N minutes.
To make aware the user of what is going on I created some pop-up messages that should appear in foreground, that disapper after few second and anywhay that don't interfere with other applications (excel is frozen during the macro excecution)

The code indeed contains several "DoEvents" that were intended to prevent this freeze, but then I realized that macros (any macro) just abort its flow as soon Excel enter the Edit Mode, i.e. when you type from the keyboard, or delete or anyway you edit cells. So eventually I removed (or better: "I commented") the DoEvents instruction to make sure the macro be completed.

In conclusion, I am afraid that what I got is working prototype rather then a finished product

Bye
Anthony47, I have been having similar trouble, I have been unable to pull out data from "Tables, Virtual Football League Mode 25974, Virtual Football, Soccer", pls can you kindly help to write the code for this page as well. i want to be able to extract home table and away table but it has only be showing the "all matches"
 

Attachments

  • Capture.JPG
    Capture.JPG
    79.8 KB · Views: 8
Upvote 0
Administrators will not be happy for this new discussion appended to an old one...

Use the code published in message #2
That way you will be able to pull ALL the tables that are presented as "<table>" on a web page.

The Sub Caller specifies wich worksheet will be populated from which url
The Sub GetTabbbSub will pull the page content with an added "manual" option: the macro will halt at the Stop, so that you can manually select which options you prefer.
From what I understood you will select "Home matchs" then and complete the macro by moving to the macro editor window and pressing F5

Since you wish to pull two tables you can simply create two "Sub Caller": the difference is that Caller1 will specify Sheets("Sheet1"), and you will manually select Home matches; whereas Caller2 will specify Sheets("Sheet2") and you will manually select Away matches

Does it work for you?
 
Upvote 0

Forum statistics

Threads
1,223,996
Messages
6,175,857
Members
452,676
Latest member
woodyp

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