Calculating age from Danish Social security number (CPR Nummer)

This VBA code is designed to calculate the age of a person in an indicated year. The danish social security number (CPR -nummer ) a  relatively complex 12 digit generated number representing the identity of an individual Danish Citizen.

In E.g Excel (TM Microsoft)  the problem about using the 5+6 number in order to figure out a persons age is that the following 4 digits places the age in the 19th,  the 20th century or  in the new millennium.

```Public Function CPRAGE(InCPR As String, InpYear As String)
Dim TAge As String
Dim IAge As Integer
Dim Placing As String
Dim Pla As Integer
Dim FinY As Integer
'converting
'extracting the right integers and converting integers into numbers
'year of birth
IAge = Mid(InCPR, 5, 2)
TAge = CInt(IAge)
'indicator of millenium of birth
PlacingA = Mid(InCPR, 7, 4)
Placing = CInt(PlacingA)
'converting year string into integer
FinY = CInt(InpYear)

If ((Placing >= 4000 And Placing <= 4999) And (TAge >= 0 And TAge <= 36)) Then
Pla = 2000
End If
If ((Placing >= 4000 And Placing <= 4999) And (TAge >= 37 And TAge <= 99)) Then
Pla = 1900
End If
If ((Placing >= 5000 And Placing <= 5999) And (TAge >= 0 And TAge <= 57)) Then
Pla = 1900
End If
If ((Placing >= 1 And Placing <= 999) And (TAge >= 1 And TAge <= 150)) Then
Pla = 1900
End If
If ((Placing >= 1000 And Placing <= 3999) And (TAge >= 1 And TAge <= 150)) Then
Pla = 1900
End If
If ((Placing >= 5000 And Placing <= 8999) And (TAge >= 0 And TAge <= 57)) Then
Pla = 2000
End If
CPRAGE = FinY - (Pla + TAge)