I have filtered a column based on certain criteria. Next I want to store the data of the visible cells in column A so I can use those values (numbers) as criteria for a new filter on a different sheet.
The code I have so far works for the largest part: only I can't seem to refer to the right rownumbers of the visible rows after the first autofilter... How can I refer to the visible rownumbers?
Sub Maybe()
Dim ws As Worksheet: Set ws = ActiveSheet
Dim CaseListArray1() As String
Dim ICount As Integer
Dim Max As Integer
Dim i As Integer
With ws
.AutoFilterMode = False
.Range("A5:A" & .Range("A" & Rows.Count).End(xlUp).Row).AutoFilter 1, Array("100018", "100127", "100180"), xlFilterValues
lcount = .AutoFilter.Range.Rows.SpecialCells(xlCellTypeVisible).Count
MsgBox lcount
For i = 1 To lcount 'Max
ICount = ICount + 1
ReDim Preserve CaseListArray1(ICount)
CaseListArray1(ICount) = Range("A" & ICount + 5).Value 'HOW DO I MAKE IT ONLY FILL THE VISIBLE CELLS?
MsgBox CaseListArray1(ICount)
Next i
Erase CaseListArray1() ' deletes the varible contents, free some memory
End With
End Sub
Bookmarks