A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Select Text Filters > Contains... from the filter drop down list.
Enter the description you want to filter on, e.g. Individuals, then click OK.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I am working on a project where I am able to select more than one option from a drop-down menu to have a list in a cell. To do this, I used a VBA code I have included below my question/description. I like having the list in each cell, however, when I try to use the filter, I am not able to filter through all rows based on a single value. Instead, I have to choose between a single option and the lists created in cells (Screenshot). If I choose to filter a single value, like "Individuals," instead of showing all rows with "Individuals" it will only show the row where only individuals appears and not the rows where "Individuals" is a part of the list. Is there a way to change the options for filtering so if a single value is chosen, the cells with lists will also appear? Or do I need to change the code used to create lists within the cells? Any ideas and options are greatly appreciated!
Code for list within single cell:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim old_val As String
Dim new_val As String
Application.EnableEvents = True
On Error GoTo Exitsub
If Target.Column = 5 Then
If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
GoTo Exitsub
Else: If Target.Value = "" Then GoTo Exitsub Else
Application.EnableEvents = False
new_val = Target.Value
Application.Undo
old_val = Target.Value
If old_val = "" Then
Target.Value = new_val
Else
If InStr(1, old_val, new_val) = 0 Then
Target.Value = old_val & vbNewLine & new_val
Else:
Target.Value = old_val
End If
End If
End If
End If
Application.EnableEvents = True
Exitsub:
Application.EnableEvents = True
End Sub
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.