Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Background: Our PO system has a leading letter (M), then 6 digits. When
an order is changed, it is given a letter at the end each time. So, you can start with a PO number M123456. If the order is changed, it becomes M123456A If it is changed again, it becomes M1234156B. It will be replaced with the next letter each time the order is changed. The list I will be setting up search macros for will have PO number that might, or might not have these trailing letters. I know the Find feature will except wildcards, since I just tried it. But, as far as in a macro, I don't know how to allow the wildcard. Here's code for searches in another macro I have. The value FindPOVal is created when the user enters the PO number in a textbox. I tried putting FindPOVal*, and tried it with "", with no success. I only want the wildcard at the end of the value. Can anyone help? Thanks, J.O. Set rngToSearch = Sheets("Official List").Columns("J") Set rngFound = rngToSearch.Find(What:=FindPOVal, _ LookIn:=xlValues, _ LookAt:=xlWhole) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Set rngFound = rngToSearch.Find(What:=FindPOVal & "?", _
LookIn:=xlValues, _ LookAt:=xlWhole) or Set rngFound = rngToSearch.Find(What:=FindPOVal & "*", _ LookIn:=xlValues, _ LookAt:=xlWhole) -- Regards, Tom Ogilvy "excelnut1954" wrote: Background: Our PO system has a leading letter (M), then 6 digits. When an order is changed, it is given a letter at the end each time. So, you can start with a PO number M123456. If the order is changed, it becomes M123456A If it is changed again, it becomes M1234156B. It will be replaced with the next letter each time the order is changed. The list I will be setting up search macros for will have PO number that might, or might not have these trailing letters. I know the Find feature will except wildcards, since I just tried it. But, as far as in a macro, I don't know how to allow the wildcard. Here's code for searches in another macro I have. The value FindPOVal is created when the user enters the PO number in a textbox. I tried putting FindPOVal*, and tried it with "", with no success. I only want the wildcard at the end of the value. Can anyone help? Thanks, J.O. Set rngToSearch = Sheets("Official List").Columns("J") Set rngFound = rngToSearch.Find(What:=FindPOVal, _ LookIn:=xlValues, _ LookAt:=xlWhole) |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You're the best, Tom.
Thanks. J.O. Tom Ogilvy wrote: Set rngFound = rngToSearch.Find(What:=FindPOVal & "?", _ LookIn:=xlValues, _ LookAt:=xlWhole) or Set rngFound = rngToSearch.Find(What:=FindPOVal & "*", _ LookIn:=xlValues, _ LookAt:=xlWhole) -- Regards, Tom Ogilvy "excelnut1954" wrote: Background: Our PO system has a leading letter (M), then 6 digits. When an order is changed, it is given a letter at the end each time. So, you can start with a PO number M123456. If the order is changed, it becomes M123456A If it is changed again, it becomes M1234156B. It will be replaced with the next letter each time the order is changed. The list I will be setting up search macros for will have PO number that might, or might not have these trailing letters. I know the Find feature will except wildcards, since I just tried it. But, as far as in a macro, I don't know how to allow the wildcard. Here's code for searches in another macro I have. The value FindPOVal is created when the user enters the PO number in a textbox. I tried putting FindPOVal*, and tried it with "", with no success. I only want the wildcard at the end of the value. Can anyone help? Thanks, J.O. Set rngToSearch = Sheets("Official List").Columns("J") Set rngFound = rngToSearch.Find(What:=FindPOVal, _ LookIn:=xlValues, _ LookAt:=xlWhole) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA Wildcard Code | Excel Discussion (Misc queries) | |||
Search/Match/Find ANY part of string to ANY part of Cell Value | Excel Worksheet Functions | |||
Using IF to find text + wildcard? | Excel Worksheet Functions | |||
Find part of a word in Advanced Filter Code | Excel Programming | |||
Help creating part of a macro (find Empty column) | Excel Programming |