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
 
thanks for the response. honesty I don't have idea on how to edit the codes looks complex to me. i haven't use VBA before
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
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?
Thank You so much for the response, I don't know to to edit it. it's my first time with VBA
 
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?
Thank You so much for the response, I don't know to to edit it. it's my first time with VBA
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?
Thank you so much, I've gotten it sir but, is there no way it would be updating automatically by refreshing(like power query), not taking me to the process again.

also it says Internet explorer is coming to an end by net month, can it make use of other browser.
thanks
 
Upvote 0
From your workbook, press Alt-F11 to open the editor of the macros; use Menu /Insert /Module to insert a standard module in your vba project.
Copy the following code and paste it into the vba module just created:
VBA Code:
Sub Call1()
    Sheets("AAA").Select       '<<< The sheet that will be loaded
    Cells.ClearContents            'NB: that sheet will be cleared!!
    Call GetTabbbSub("https://s5.sir.sportradar.com/bet9javirtuals/en/1/season/2382095/standings")     '<<< Your starting Url
    Cells.WrapText = False
End Sub

Sub Call2()
    Sheets("BBB").Select       '<<< The sheet that will be loaded
    Cells.ClearContents            'NB: that sheet will be cleared!!
    Call GetTabbbSub("https://s5.sir.sportradar.com/bet9javirtuals/en/1/season/2382095/standings")     '<<< Your starting Url
    Cells.WrapText = False
End Sub

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
Modify those Sheets("AAA") and Sheets("BBB") to point to the worksheet that will be used to import the tables; BEWARE: the worksheets wii be cleared before importing the table

Then return to excel; press Alt-F8, select Call1 and press Run. The macro Call1 will start and will open the target web page; complete manually the navigation by specifying which info you wish to collect (home matches, I guess). Switch to the macro editor and press F5 to complete the macro.
Repeat the process to excecute Call2 and import the second class of information.
 
Upvote 0
From your workbook, press Alt-F11 to open the editor of the macros; use Menu /Insert /Module to insert a standard module in your vba project.
Copy the following code and paste it into the vba module just created:
VBA Code:
Sub Call1()
    Sheets("AAA").Select       '<<< The sheet that will be loaded
    Cells.ClearContents            'NB: that sheet will be cleared!!
    Call GetTabbbSub("https://s5.sir.sportradar.com/bet9javirtuals/en/1/season/2382095/standings")     '<<< Your starting Url
    Cells.WrapText = False
End Sub

Sub Call2()
    Sheets("BBB").Select       '<<< The sheet that will be loaded
    Cells.ClearContents            'NB: that sheet will be cleared!!
    Call GetTabbbSub("https://s5.sir.sportradar.com/bet9javirtuals/en/1/season/2382095/standings")     '<<< Your starting Url
    Cells.WrapText = False
End Sub

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
Modify those Sheets("AAA") and Sheets("BBB") to point to the worksheet that will be used to import the tables; BEWARE: the worksheets wii be cleared before importing the table

Then return to excel; press Alt-F8, select Call1 and press Run. The macro Call1 will start and will open the target web page; complete manually the navigation by specifying which info you wish to collect (home matches, I guess). Switch to the macro editor and press F5 to complete the macro.
Repeat the process to excecute Call2 and import the second class of information.
Thank you so much, I so much appreciate sir
 
Upvote 0
From your workbook, press Alt-F11 to open the editor of the macros; use Menu /Insert /Module to insert a standard module in your vba project.
Copy the following code and paste it into the vba module just created:
VBA Code:
Sub Call1()
    Sheets("AAA").Select       '<<< The sheet that will be loaded
    Cells.ClearContents            'NB: that sheet will be cleared!!
    Call GetTabbbSub("https://s5.sir.sportradar.com/bet9javirtuals/en/1/season/2382095/standings")     '<<< Your starting Url
    Cells.WrapText = False
End Sub

Sub Call2()
    Sheets("BBB").Select       '<<< The sheet that will be loaded
    Cells.ClearContents            'NB: that sheet will be cleared!!
    Call GetTabbbSub("https://s5.sir.sportradar.com/bet9javirtuals/en/1/season/2382095/standings")     '<<< Your starting Url
    Cells.WrapText = False
End Sub

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
Modify those Sheets("AAA") and Sheets("BBB") to point to the worksheet that will be used to import the tables; BEWARE: the worksheets wii be cleared before importing the table

Then return to excel; press Alt-F8, select Call1 and press Run. The macro Call1 will start and will open the target web page; complete manually the navigation by specifying which info you wish to collect (home matches, I guess). Switch to the macro editor and press F5 to complete the macro.
Repeat the process to excecute Call2 and import the second class of information.
Sir, I want to ask a couple of questions

it was announced that Internet explorer would be retired by 22nd of june 2022, would it affect this?

My second question is, how can I refresh it automatically, like power querry?

thanks
 
Upvote 0
I don't know what will happen with IE in the short terms, but in the long run the webpages will no longer accept IE as browser, many of then are already incompatible.
I am not a specialist of Power Query, so I cannot help.
As for the traditional approach (via browser), a possible alternative is using the Selenium enironment, that allows working with the new family of browser; see this discussion on how Selenium:
If you install this environment I should be able to provide a macro that would import the two tables without the need for user clicks
 
Upvote 0
I don't know what will happen with IE in the short terms, but in the long run the webpages will no longer accept IE as browser, many of then are already incompatible.
I am not a specialist of Power Query, so I cannot help.
As for the traditional approach (via browser), a possible alternative is using the Selenium enironment, that allows working with the new family of browser; see this discussion on how Selenium:
If you install this environment I should be able to provide a macro that would import the two tables without the need for user clicks
Thank you so much
 
Upvote 0
Hello Anthony, how have you been?,I have downloaded and install the Sellenium but Unable to use it with the earlier code. i tried replacing the IE with edge but it's giving me errors.

pls can you kindly help out, thanks
 
Upvote 0
For any development it is necessary to know which is the target url and which data should be collected.
The link in your initial message is now broken, and which information to collect has never been specified.

Also, beeing this thread 1year and a half old, beeing this a new question and since we are ready to start from Zero I should suggest that uou open a fresh new thread.
 
Upvote 0

Forum statistics

Threads
1,223,997
Messages
6,175,874
Members
452,679
Latest member
darryl47nopra

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