简体   繁体   中英

How to find RowCount of a table which pasted from web to excel

im recieving a table from web in excel with the code below

With ActiveSheet.QueryTables.Add(Connection:= _
    "URL;some url")
    .WebSelectionType = "xlSpecifiedTables"
    .WebTables = "10"
    .BackgroundQuery = True
    .TablesOnlyFromHTML = True
    .Refresh BackgroundQuery:=False
    .SaveData = True
End With

but also i wanna get the row count from that table i got. so how can i achive that?

With ActiveSheet.QueryTables.Add(Connection:= _
    "URL;some url")
    .LineCount 'is it smt like this???????
End With

Why not simply use something like Range("B3").CurrentRegion.Rows.Count ?
Note that you can't know the # rows to be downloaded before actually downloading them, and since you are using .BackgroundQuery = True , you don't really know when the download is complete...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM