Excel VBA "Object or With Block variable not set"
Posted on 2010-01-10
Hi there, I can't figure out why my code stops on the second line of code (tbldata2VisCount) and not on the first? I hover over tbldataVisCount and it shows the correct count of filtered items but when I hover over tbldata2VisCount, the result = Emply
Dim tbldataVisCount As Variant
Dim tbldata2VisCount As Variant
tbldataVisCount = Sheet4.AutoFilter.Range.Columns(1).SpecialCells(xlCellTypeVisible).Count - 1
tbldata2VisCount = Sheet2.AutoFilter.Range.Columns(1).SpecialCells(xlCellTypeVisible).Count - 1 ' this line keeps breaking
dblCount = tbldataVisCount + tbldata2VisCount