I have a workbook containing downloaded Emails and I now need to identify a particular code appearing somewhere in the Subject field. I am using Excel 2007.
The code will always be 8-numbers and should start and end with a space, unless at start or end of Subject Line (but often people put punctuation instead - e.g. , or
. There also may be a code of 10-numbers that I do not want to incorrectly identify.
I am using "Like" to identify the pattern but it does not seem to be working correctly.
As I read the help section, the "*[!#]########[!#]*" should look for eight numbers where the characters either side are not a number. The second and third tests are for the cases when the code starts/ends the Subject line.
For the example "Shipment Notification WARE - GSK SOUTH AFRICA - 10097777 - 577758340010001 - AIR" it correctly identifies the "10097777" as valid.
However for "RE: Packing list Notification>Barnard Castle>Israel>FPA: 578707300010001, 578688000000000" it finds the first two tests as TRUE. It results in a code of "00010001"
Can anybody tell me why "Like" gives a TRUE result for the second example and also how to fix it?
Thanks
The code will always be 8-numbers and should start and end with a space, unless at start or end of Subject Line (but often people put punctuation instead - e.g. , or

I am using "Like" to identify the pattern but it does not seem to be working correctly.
Code:
If Subject_Array(Data_Row) Like "*[!#]########[!#]*" = True Or _
Subject_Array(Data_Row) Like "*[!#]########" = True Or _
Subject_Array(Data_Row) Like "########[!#]*" = True Then
As I read the help section, the "*[!#]########[!#]*" should look for eight numbers where the characters either side are not a number. The second and third tests are for the cases when the code starts/ends the Subject line.
For the example "Shipment Notification WARE - GSK SOUTH AFRICA - 10097777 - 577758340010001 - AIR" it correctly identifies the "10097777" as valid.
However for "RE: Packing list Notification>Barnard Castle>Israel>FPA: 578707300010001, 578688000000000" it finds the first two tests as TRUE. It results in a code of "00010001"
Can anybody tell me why "Like" gives a TRUE result for the second example and also how to fix it?
Thanks