0
I am using VBA to apply a filter in the phone numbers column.
The phone numbers are treated in a personalized way to stay in the model (XX) XXXXX-XXXX or (XX) XXXX-XXXX
I take the value of a cell and use as the value for the filter search.
Follows the code:
If Not IsEmpty(Range("B7")) Then
Range("A12").AutoFilter Field:=2, Criteria1:=Range("B7").Value
End If
I get no return when the value is formatted
What behavior did you expect? The code does not include anything related to being or not formatted in X or Y form. What this code snippet does is just the following: if cell B7 is not empty, go to the existing filter that covers cell A12, take the second column and configure to show only the values equivalent to B7. Does it behave any other way than this? Gives some error message?
– César Rodriguez
Also, a "=" is missing in the parameter
Criteria1
. Was supposed to beCriteria1:=Range("B7").Value
– César Rodriguez
@Césarrodriguez is correct! I’m actually trying to find a way to do the search to filter the values with custom formatting, I tried using Numberformat but also did not get result because it was returning FALSE and not the formatted number. The result I get is a filter without the symbols that are used in custom formatting, but I haven’t found a way to solve this yet.
– Vítor Sousa