Пожалуйста, не пытайтесь создать две копии ваших данных.Ведение двух версий одних и тех же данных очень и очень сложно.
Я считаю, что лучшим вариантом для вас является создание макроса, с помощью которого ваши пользователи смогут выбирать необходимый им фильтр.
Вы делаетене буду подробно описывать ваши данные, поэтому я вообразил что-то вроде следующего:
Name Addr Tele List1 List2 List3 List4 List5
John London 1234 x
Jane Paris 2345 x
Kevin Stockholm 3456 x
Mary Brussels 4567 x
Nigel Dublin 5678 x
Abby Athens 6789 x x x
Brian Rome 7890 x
Учитывая приведенный выше макет, следующий макрос показывает то, что я бы предложил.
Когдамакрос выполняется, он отображает поле ввода следующим образом:
![enter image description here](https://i.stack.imgur.com/V6IHv.png)
, из которого пользователь может выбрать требуемый фильтр.
Надеюсь, это даст вам некоторые идеи.
Option Explicit
Sub SelectFilter()
Dim ColNum() As Variant
Dim InxList As Long
Dim ListName() As Variant
Dim Prompt As String
Dim ReturnValue As Variant
' Load ListName with user-friendly names for the lists
ListName = Array("Name list 1", "Name list 2", "Name list 3", _
"Name list 4", "Name list 5")
' Load ColNum with the column number for each list. The entries in ColNum
' must be in the same sequence as the entries in ListName. Column "A" is
' column 1, column "B" is column 2 and so on.
ColNum = Array(4, 5, 6, 7, 8)
' Combine the user-friendly list names to create a menu
Prompt = ""
For InxList = 0 To UBound(ListName)
Prompt = Prompt & InxList + 1 & ". " & ListName(InxList) & vbLf
Next
Prompt = Prompt & "Please enter the number against the list you require." _
& vbLf & "Leave box empty to cancel selection."
' Loop until user cancels or enters a permitted value
Do While True
ReturnValue = InputBox(Prompt, "Select filter")
If VarType(ReturnValue) = vbBoolean Then
If Not ReturnValue Then
' The documentation for InputBox claims it returns False if
' the user clicks Cancel. In my experience it return a
' null string but check to be on the safe side.
Exit Sub
Else
' True is not a documented return value from InputBox.
' This code should never be executed but if something
' goes wrong there is a message for the user.
Call MsgBox("Please report there has been a InputBox " & _
"error type 1 to Chaka", vbCritical)
Exit Sub
End If
End If
If VarType(ReturnValue) <> vbString Then
' False or a string are the only documented return values
' This code should never be executed but if something
' goes wrong there is a message for the user.
Call MsgBox("Please report there has been a InputBox " & _
"error type 2 to Chaka", vbCritical)
Exit Sub
End If
If ReturnValue = "" Then
' User has clicked cancel or left the text box empty.
Exit Sub
End If
If IsNumeric(ReturnValue) Then
InxList = ReturnValue - 1
If InxList >= 0 And InxList <= UBound(ListName) Then
' Good selection
Exit Do
End If
End If
Loop
With Sheets("Sheet2")
If .AutoFilterMode Then
' AutoFilter is on. Cancel current selection before applying
' new one because criteria are additive.
.AutoFilterMode = False
End If
.Cells.AutoFilter Field:=ColNum(InxList), Criteria1:="x"
End With
End Sub