Wildcards or values in a macro?
Closed
sworcester
Posts
2
Registration date
Tuesday November 22, 2016
Status
Member
Last seen
November 22, 2016
-
Nov 22, 2016 at 11:58 AM
Blocked Profile - Nov 22, 2016 at 04:58 PM
Blocked Profile - Nov 22, 2016 at 04:58 PM
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.
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.
Related:
- Wildcards or values in a macro?
- Spell number in excel without macro - Guide
- Excel macro to create new sheet based on value in cells - Guide
- Macros in excel download free - Download - Spreadsheets
- Run macro when cell value changes by formula ✓ - Excel Forum
- Based on the values in cells b77 b88 - Excel Forum
2 responses
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Nov 22, 2016 at 12:06 PM
Nov 22, 2016 at 12:06 PM
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
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
sworcester
Posts
2
Registration date
Tuesday November 22, 2016
Status
Member
Last seen
November 22, 2016
Nov 22, 2016 at 03:39 PM
Nov 22, 2016 at 03:39 PM
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
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