My main goal is to copy the visible cells of an autofilter and later copy the dimensions of the visible cells to the new sheet. I am using this code:
Sheets(1).AutoFilterMode = False
Sheets(1).Range("A1:A1").AutoFilter Field:=columnaNumeroIntervalo, criteria1:=CDec(paramCantidadCriterio)
Sheets(1).Range("A1:A1").AutoFilter Field:=columnaNumeroIntervaloUnidades, Criteria1:=paramUnidadesCriterio
MsgBox AutoFilter.Range.SpecialCells(xlCellTypeVisible)(2, 11).Value
With the last line I want to check the value o a cell. If I use Cells(2,11)
instead of SpecialCells
I can see that cells have all the cells of the sheet, visible and not visible. So I want to use SpecialCells
.
If I use Special cells I get the following error:
error '-2147417848 (80010108) in runtime. Automatization error.
For the time an the type of the execution, it seem to enter in a loop, and finally gives this error. Perhaps SpecialCells modify the autofilter and then in each modification execute again the autofilter?
Cells(2,11)
. Am I missing something? – markblandford