Despite the number of questions on this topic I haven't been able to find the resolution to my issue (which may or may not be my fault).
I need to autofilter a range to return blanks and numbers beginning with 614.
This column has been preformatted using the following:
Range("B:C").NumberFormat = "###0"
This is to remove the scientific notation format that Excel wants to use on some of the numbers.
I then use the following to apply the filter:
With ActiveSheet
.AutoFilterMode = False 'remove any active filters
.Range("A1:O1").AutoFilter Field:=2, Criteria1:="614*", Operator:=xlOr, Criteria2:="="
End With
No matter how I apply the filter, including the use of an array, the filter only returns the blank values. I have also used Criteria1:="=614*" for the same result.
The only thing I am certain about is that the number is going to start with 614 and will have a variety of combinations following.
Is the problem with the data type? Blanks are strings and numbers are numbers? There has been only one blog that has slightly addressed this issue and seems to indicate that I cannot use wildcards in this instance. Is this correct?
Essentially the numbers are Australian mobile numbers therefore have a length of 11 characters with only the first 3 being a constant. This is why I really want to use a wildcard to find these records. I need to eliminate these plus the blanks from the dataset. According to your responses and what I was largely beginning to realise my only choice is to convert the numbers to strings if I want to do this as a one step process. This will affect later code. I am assuming that this can't be done as part of the autofilter criteria (wishful thinking)?
Starts With
option. Or find numbers6140<=x<=6149
. – Hultgren