Concatenate string array as a multiple criteria for filter
04:11 25 Jun 2019

I want to concatenate a string array inside a AutoFilter.

I just used macro recorder for this code.

I'm trying to get the same output of this and i don't want to brute force all of the possible conditions.

 ActiveSheet.Range("$A$8:$BH$331").AutoFilter Field:=4, Criteria1:=Array( _
    "ISO 14001","ISO 45001", "ISO 9001", "OHSAS 18001", "QMET"), Operator:=xlFilterValues

But I need to concatenate each text if the condition is met.

Dim strStandard(0 To 5) As String    
strStandard(0) = "ISO 9001"
strStandard(1) = "ISO 14001"
strStandard(2) = "ISO 45001"
strStandard(3) = "QMET"
strStandard(4) = "OHSAS 18001"
strStandard(5) = "Combined (14K+18K)
If ISO9001.Value = True = True Then
    ActiveSheet.Range("$A$8:$BH$331").AutoFilter Field:=4, Criteria1:=ISO9001.Value
End If
If ISO14001.Value = True = True Then
 ActiveSheet.Range("$A$8:$BH$331").AutoFilter Field:=4, Criteria1:= _
   "ISO 14001"
End If

strStandard will be the multiple criteria for the filter

My Idea is to check every checkbox if it's value is true if is true it will get the string from strStandard array and pass it to strFilterContainer for string array then a single Autofilter

ActiveSheet.Range("$A$8:$BH$331").AutoFilter Field:=4, Criteria1:=strFilterContainer, Operator:=xlFilterValues

strStandard will be the multiple criteria for the filter Is there a way to concatenate the string array inside the AutoFilter?

excel vba