Test the folowing codes,please:
Sub Selecttable(ByVal url As String, ByVal n As Long) Dim t, r As Object, i As Long WebBrowser1.Navigate url, False Do While Sheet1.WebBrowser1.readyState <> 4 DoEvents Loop For Each t In WebBrowser1.Document.All If LCase(t.tagName) = "table" Then i = i + 1 If i > n Then WebBrowser1.Stop Set r = .WebBrowser1.Document.body.createControlRange() r.Add (t) r.execCommand ("SelectAll") Exit For End If End If Next End Sub