I have a sheet called "Entity" which has been created by a sub. This sheet has a table that can contain double Entitynumbers in column 4. To check this I wrote another sub that does that for me. The double Entitynumbers are placed in the same sheet at cell CM2 downwards. I just want to filter the table with these double Entitynumbers.
I have been Googling for it and I know the solution is Autofilter. Somehow I can't fully grasp it. I have been playing around a bit with this and in the original file a simple sub like this one works just fine.
Code: Select all
Sub MyAutoFilter()
ActiveSheet.Range("$A$1:$CK$699").AutoFilter _
Field:=4, _
Criteria1:=Array("4000894", "4664176"), _
Operator:=xlFilterValues
End Sub
This sub doesn't work:
Code: Select all
Sub MyAutoFilter1()
ActiveSheet.Range("$A$1:$CK$699").AutoFilter _
Field:=4, _
Criteria1:=ActiveSheet.Range("CM2:CM4"), _
Operator:=xlFilterValues
End Sub
Anyone who can help me out here with a code that should do the trick. I have enclosed a xlsx.file with some dummy-info that can be used for this purpose. The idea is to filter column 4 by the range in F2:F4.