excel - VBA Count Table Rows which Contain data -


this question has answer here:

follow on earlier question. trying count number of rows in table contain data (not counting number of rows part of table).

for example, table is: enter image description here

my code is:

with thisworkbook.worksheets(1)     set atb = .listobjects("table1")     .activate     numberrows = .cells(.rows.count, "a").end(xlup).row end with` 

this returns wrong number (trust me column has same data count) enter image description here

likewise, want use vba resize table nicely need row count that.

try this

sub check()     thisworkbook.worksheets("sheet1")         set atb = .listobjects("table1")         .activate         numberrows = application.counta(.range("a:a"))     end end sub 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -