Wildcards or values in a macro?

[Closed]
Report
Posts
3
Registration date
Tuesday November 22, 2016
Status
Member
Last seen
November 22, 2016
-
 Blocked Profile -
Hello, I created a macro (by recording) that looks at the names and picks them based on the full name.
Is there a way to just use a wildcard?
Instead of the list being "Superman", "Super man", "Supergirl", "Super girl"
could I use something like "Super*", assuming I wanted all values with "super" in the beginning of the text value.

I have tried that example and it doesn't work.

2 replies

Posts
2818
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
October 18, 2021
486
Hi Sworcester,

Use "Like" instead of "=" when using "*" as in:
If range("A1").value like "*Super*" then

or
If left(range("A1").value,5) = "Super" then
will work as well.

Best regards,
Trowa
Posts
3
Registration date
Tuesday November 22, 2016
Status
Member
Last seen
November 22, 2016

Here is kinda what gets spit out

Sub SMC_Sys()
'
' SMC_Sys Macro
'

'
ActiveSheet.Range("$A$1:$CH$52073").AutoFilter Field:=14, Criteria1:=Array( _
"Vendor 1", "vendor 2", "another", "yet another", _
etc etc etc... ), Operator:= _
xlFilterValues
End Sub

I am trying to not have to alter much or write much, instead using the RECORD function to d most of the work. The idea is to create a macro that is portable for every month so the RANGE may change each month as well
Blocked Profile
So load the range into a variable, and load that variable as the range. NOT EVERYTHING COMES WITH AN EASY BUTTON!