Finding an ISIN code

Nick28

New Member
Joined
May 7, 2009
Messages
13
Hi

I am trying to write a code that can recognise an ISIN code, these are IDs for securities (like a SEDOL). They always start with 2 letters and are succeded by 10 numbers, the code loops through a block of text and the ISIN will be in a specific column. I just need to know how the code could identify an ISIN code in a specified column:

For intRow1 = intLastRow1 To 1 Step -1
Rows(intRow1).Select
If Cells(intRow1, 2).Value = "ISIN" Then
Cells(intRow1, 1).Select
Selection.EntireRow.Copy

Example of ISIN

FR0000000000
GB1111111111
XS2222222222

Any ideas

Thanks
 
Also should mention that the code needs to identify the extact type of the string (2 letters and 10 numbers like):

"[A-Z][A-Z][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"

If it just looks for 12 characters then it will extract other unwanted infomation

Cheers
 
Upvote 0
I am trying to write a code that can recognise an ISIN code, these are IDs for securities (like a SEDOL). They always start with 2 letters and are succeded by 10 numbers, the code loops through a block of text and the ISIN will be in a specific column.

Just in case it may be a problem for you, I should mention that ISINs do not always follow that format.

They are always 12 characters in length. T
They always begin with two alphabetical characters, and the last character is always a number.

However, character positions 3 through to 11 are alphanumeric - they are not necessarily numbers.
 
Upvote 0
You are right - thanks for pointing this out. I guess I could have an issue with that

Cheers
 
Upvote 0
Andrew - tried the code and it worked (just need brackets)

If Cells(intRow1, 2).Value Like ("[A-Z][A-Z]##########") Then

But as Colin pointed out characters 3-11 are alphanumeric and 12 is numeric so tried this

If Cells(intRow1, 2).Value Like ("[A-Z][A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9]") Then

which worked great.

Thanks to all for your time and help on this.

Nick
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top