title: How to validate a LEI code
body: <p>I am writing a Macro to validate LEI codes. </p>
  
  <p>LEI Code is:</p>
  
  <ol>
  <li>20 char string</li>
  <li>First 18 chars alphanumeric </li>
  <li>Last two chars numeric</li>
  </ol>
  
  <p>Example: F50EOCWSQFAUVO9Q8Z97</p>
  
  <p>Validation</p>
  
  <ol>
  <li>Replace all alphabetical chars in string with 2 digit number to create integer</li>
  <li>If mod of integer divided by 97 is 1 then code valid, else invalid</li>
  </ol>
  
  <p>I have written the below:</p>
  
  <pre><code>Sub Test()
  
  Dim LEI_String As String
  
      LEI_String = Range("B1")
  
      LEI_String = Replace(LEI_String, "A", "10")
      LEI_String = Replace(LEI_String, "B", "11")
      LEI_String = Replace(LEI_String, "C", "12")
      LEI_String = Replace(LEI_String, "D", "13")
      LEI_String = Replace(LEI_String, "E", "14")
      LEI_String = Replace(LEI_String, "F", "15")
      LEI_String = Replace(LEI_String, "G", "16")
      LEI_String = Replace(LEI_String, "H", "17")
      LEI_String = Replace(LEI_String, "I", "18")
      LEI_String = Replace(LEI_String, "J", "19")
      LEI_String = Replace(LEI_String, "K", "20")
      LEI_String = Replace(LEI_String, "L", "21")
      LEI_String = Replace(LEI_String, "M", "22")
      LEI_String = Replace(LEI_String, "N", "23")
      LEI_String = Replace(LEI_String, "O", "24")
      LEI_String = Replace(LEI_String, "P", "25")
      LEI_String = Replace(LEI_String, "Q", "26")
      LEI_String = Replace(LEI_String, "R", "27")
      LEI_String = Replace(LEI_String, "S", "28")
      LEI_String = Replace(LEI_String, "T", "29")
      LEI_String = Replace(LEI_String, "U", "30")
      LEI_String = Replace(LEI_String, "V", "31")
      LEI_String = Replace(LEI_String, "W", "32")
      LEI_String = Replace(LEI_String, "X", "33")
      LEI_String = Replace(LEI_String, "Y", "34")
      LEI_String = Replace(LEI_String, "Z", "35")
  
  
      MsgBox Len(LEI_String)
      Range("B2").Value = CCur(LEI_String) Mod 97
      MsgBox CCur(LEI_String) Mod 97
  
  End Sub
  </code></pre>
  
  <p>And am of course getting run-time error 6 overflow errors as the integer I am working with is 35 digits long. </p>
  
  <p>Is there a way of working around this?</p>