0

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
pnuts
  • 58,317
  • 11
  • 87
  • 139
Berker Yüceer
  • 7,026
  • 18
  • 68
  • 102

1 Answers1

2

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...

iDevlop
  • 24,841
  • 11
  • 90
  • 149
  • What if the region that i want has some empty cells i mean entire row has empty cells or entire column has empty cells which are used like a seperator for cell values, could stop the function counting the range right? Than the range command would not work unless i use smt like: i = i + 1 and then Range("B" & i).CurrentRegion.Rows.Count whenever it founds empty cells and if empty cells occurs more than once would stop the loop.. yea that may work.. unless u have a better solution for empty cells i can use this.. anyways its a good call so thanks also +1 for simplicity. – Berker Yüceer Feb 20 '12 at 12:12