Share via

How to change options showing in filter listbox?

Anonymous
2023-03-20T18:06:48+00:00

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

Microsoft 365 and Office | Excel | Other | Windows

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.

0 comments No comments

1 answer

Sort by: Most helpful
  1. HansV 462.6K Reputation points
    2023-03-20T18:55:47+00:00

    Select Text Filters > Contains... from the filter drop down list.

    Enter the description you want to filter on, e.g. Individuals, then click OK.

    Was this answer helpful?

    0 comments No comments