0
Hello friends I am banging my head in a vba code, what I want and when I Filter a column for example "A1" it counts all visible cells, ignore hidden cells and stop counting when find the first empty cell and print the value counted in cell "B12", below the code it even works but I have to put a wider range than the column data, and it ends up counting the blank of the range along with the visible ones I want.
Sub CountVisRows()
Range("b12").Value = ActiveSheet.Cells(1, 1).Range("A14:A4000").Cells.SpecialCells(xlCellTypeVisible).Count
End Sub
Thank you for helping but it is returning me value 0, when I filter the column I would like it to count only the visible cells and ignore the hidden cells and show the value in a cell from the "A" column "14" on until I find the empty A column cell.
– arthurvalenca
This is exactly what it does. You need to change the columns and rows for your spreadsheet. I just made a template. If the column to filter is "A" then change the code of While Cells(i, 4). Value for While Cells(i, 1). Value, because it is the first column. And you need to adjust the value of " i " to the first row where your data starts after column labels. For example, if the first record is on line 2, you change it to i = 2.
– Clovis Daniel Costa
And for the total change Cells(1, 4). Value = cont to desired column and row. (in my example is row 1 and column 4, which is the same thing as D1.
– Clovis Daniel Costa