Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Find macro with wildcard as part of code

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Find macro with wildcard as part of code

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Find macro with wildcard as part of code

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Wildcard Code Tony Excel Discussion (Misc queries) 8 May 15th 09 03:34 PM
Search/Match/Find ANY part of string to ANY part of Cell Value TWhizTom Excel Worksheet Functions 0 July 21st 08 08:16 PM
Using IF to find text + wildcard? Outlook, eh? Excel Worksheet Functions 8 July 3rd 07 04:46 PM
Find part of a word in Advanced Filter Code Sierras Excel Programming 5 March 10th 06 07:44 PM
Help creating part of a macro (find Empty column) Jay[_17_] Excel Programming 2 May 27th 04 08:46 PM


All times are GMT +1. The time now is 06:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"