VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "REE"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Dim nLa As Integer
Dim nCe As Integer
Dim nPr As Integer
Dim nNd As Integer
Dim nPm As Integer
Dim nSm As Integer
Dim nEu As Integer
Dim nGd As Integer
Dim nTb As Integer
Dim nDy As Integer
Dim nHo As Integer
Dim nEr As Integer
Dim nTm As Integer
Dim nYb As Integer
Dim nLu As Integer


Public Sub DeterminaREEPresenti()

On Error GoTo ret

For i = 1 To 15
REE1(i) = True
Next i

'determino la colonna di la
nLa = 101
For i = 1 To Numelem
If Elementi(i) = "La" Then
nLa = i
End If
Next i
If nLa = 101 Then
REE1(1) = False
End If


'determino la colonna di Ce
nCe = 101
For i = 1 To Numelem
If Elementi(i) = "Ce" Then
nCe = i
End If
Next i
If nCe = 101 Then
REE1(2) = False
End If

'determino la colonna di Pr
nPr = 101
For i = 1 To Numelem
If Elementi(i) = "Pr" Then
nPr = i
End If
Next i
If nPr = 101 Then
REE1(3) = False
End If


'determino la colonna di Nd
nNd = 101
For i = 1 To Numelem
If Elementi(i) = "Nd" Then
nNd = i
End If
Next i
If nNd = 101 Then
REE1(4) = False
End If


'determino la colonna di Pm
nPm = 101
For i = 1 To Numelem
If Elementi(i) = "Pm" Then
nPm = i
End If
Next i
If nPm = 101 Then
REE1(5) = False
End If


'determino la colonna di Sm
nSm = 101
For i = 1 To Numelem
If Elementi(i) = "Sm" Then
nSm = i
End If
Next i
If nSm = 101 Then
REE1(6) = False
End If


'determino la colonna di Eu
nEu = 101
For i = 1 To Numelem
If Elementi(i) = "Eu" Then
nEu = i
End If
Next i
If nEu = 101 Then
REE1(7) = False
End If



'determino la colonna di Gd
nGd = 101
For i = 1 To Numelem
If Elementi(i) = "Gd" Then
nGd = i
End If
Next i
If nGd = 101 Then
REE1(8) = False
End If


'determino la colonna di Tb
nTb = 101
For i = 1 To Numelem
If Elementi(i) = "Tb" Then
nTb = i
End If
Next i
If nTb = 101 Then
REE1(9) = False
End If



'determino la colonna di Dy
nDy = 101
For i = 1 To Numelem
If Elementi(i) = "Dy" Then
nDy = i
End If
Next i
If nDy = 101 Then
REE1(10) = False
End If


'determino la colonna di Ho
nHo = 101
For i = 1 To Numelem
If Elementi(i) = "Ho" Then
nHo = i
End If
Next i
If nHo = 101 Then
REE1(11) = False
End If


'determino la colonna di Er
nEr = 101
For i = 1 To Numelem
If Elementi(i) = "Er" Then
nEr = i
End If
Next i
If nEr = 101 Then
REE1(12) = False
End If


'determino la colonna di Tm
nTm = 101
For i = 1 To Numelem
If Elementi(i) = "Tm" Then
nTm = i
End If
Next i
If nTm = 101 Then
REE1(13) = False
End If

'determino la colonna di Yb
nYb = 101
For i = 1 To Numelem
If Elementi(i) = "Yb" Then
nYb = i
End If
Next i
If nYb = 101 Then
REE1(14) = False
End If


'determino la colonna di Lu
nLu = 101
For i = 1 To Numelem
If Elementi(i) = "Lu" Then
nLu = i
End If
Next i
If nLu = 101 Then
REE1(15) = False
End If

GoTo ret1
ret:
MsgBox "An Error Occurred: REE-spider failed", , "Attenzione"
ret1:

End Sub

Public Sub CaricaNormalizzazione(file As String)

On Error GoTo ret

Open file For Input As #1

For i = 1 To 15

Input #1, aa

NormREE(i) = Val(aa)

Next i

GoTo ret1
ret:
MsgBox "An Error Occurred: REE-spider failed", , "Attenzione"
ret1:

Close #1


End Sub




Public Sub DeterminaValoriREE(NumCamp)

On Error GoTo ret

For i = 1 To 15
REEabsent(i) = True
REEabsent1(i) = True
Next i


'determino la colonna di la
nLa = 101
For i = 1 To Numelem
If Elementi(i) = "La" Then
nLa = i
REEabsent(1) = False
REEabsent1(1) = False
End If
Next i
If nLa = 101 Then
REEabsent(1) = True
REEabsent1(1) = True
GoTo f1
End If
If DatiOrigine(NumCamp, nLa) <= 0 Then
REEabsent(1) = True
REEabsent1(1) = True
End If
f1:

'determino la colonna di Ce
nCe = 101
For i = 1 To Numelem
If Elementi(i) = "Ce" Then
nCe = i
REEabsent(2) = False
REEabsent1(2) = False
End If
Next i
If nCe = 101 Then
REEabsent(2) = True
REEabsent1(2) = True
GoTo f2
End If
If DatiOrigine(NumCamp, nCe) <= 0 Then
REEabsent(2) = True
REEabsent1(2) = True
End If
f2:


'determino la colonna di Pr
nPr = 101
For i = 1 To Numelem
If Elementi(i) = "Pr" Then
nPr = i
REEabsent(3) = False
REEabsent1(3) = False
End If
Next i
If nPr = 101 Then
REEabsent(3) = True
REEabsent1(3) = True
GoTo f3
End If
If DatiOrigine(NumCamp, nPr) <= 0 Then
REEabsent(3) = True
REEabsent1(3) = True
End If
f3:


'determino la colonna di Nd
nNd = 101
For i = 1 To Numelem
If Elementi(i) = "Nd" Then
nNd = i
REEabsent(4) = False
REEabsent1(4) = False
End If
Next i
If nNd = 101 Then
REEabsent(4) = True
REEabsent1(4) = True
GoTo f4
End If
If DatiOrigine(NumCamp, nNd) <= 0 Then
REEabsent(4) = True
REEabsent1(4) = True
End If
f4:


'determino la colonna di Pm
nPm = 101
For i = 1 To Numelem
If Elementi(i) = "Pm" Then
nPm = i
REEabsent(5) = False
REEabsent1(5) = False
End If
Next i
If nPm = 101 Then
REEabsent(5) = True
REEabsent1(5) = True
GoTo f5
End If
If DatiOrigine(NumCamp, nPm) <= 0 Then
REEabsent(5) = True
REEabsent1(5) = True
End If
f5:


'determino la colonna di Sm
nSm = 101
For i = 1 To Numelem
If Elementi(i) = "Sm" Then
nSm = i
REEabsent(6) = False
REEabsent1(6) = False
End If
Next i
If nSm = 101 Then
REEabsent(6) = True
REEabsent1(6) = True
GoTo f6
End If
If DatiOrigine(NumCamp, nSm) <= 0 Then
REEabsent(6) = True
REEabsent1(6) = True
End If
f6:


'determino la colonna di Eu
nEu = 101
For i = 1 To Numelem
If Elementi(i) = "Eu" Then
nEu = i
REEabsent(7) = False
REEabsent1(7) = False
End If
Next i
If nEu = 101 Then
REEabsent(7) = True
REEabsent1(7) = True
GoTo f7
End If
If DatiOrigine(NumCamp, nEu) <= 0 Then
REEabsent(7) = True
REEabsent1(7) = True
End If
f7:


'determino la colonna di Gd
nGd = 101
For i = 1 To Numelem
If Elementi(i) = "Gd" Then
nGd = i
REEabsent(8) = False
REEabsent1(8) = False
End If
Next i
If nGd = 101 Then
REEabsent(8) = True
REEabsent1(8) = True
GoTo f8
End If
If DatiOrigine(NumCamp, nGd) <= 0 Then
REEabsent(8) = True
REEabsent1(8) = True
End If
f8:


'determino la colonna di Tb
nTb = 101
For i = 1 To Numelem
If Elementi(i) = "Tb" Then
nTb = i
REEabsent(9) = False
REEabsent1(9) = False
End If
Next i
If nTb = 101 Then
REEabsent(9) = True
REEabsent1(9) = True
GoTo f9
End If
If DatiOrigine(NumCamp, nTb) <= 0 Then
REEabsent(9) = True
REEabsent1(9) = True
End If
f9:


'determino la colonna di Dy
nDy = 101
For i = 1 To Numelem
If Elementi(i) = "Dy" Then
nDy = i
REEabsent(10) = False
REEabsent1(10) = False
End If
Next i
If nDy = 101 Then
REEabsent(10) = True
REEabsent1(10) = True
GoTo f11
End If
If DatiOrigine(NumCamp, nDy) <= 0 Then
REEabsent(10) = True
REEabsent1(10) = True
End If
f11:


'determino la colonna di Ho
nHo = 101
For i = 1 To Numelem
If Elementi(i) = "Ho" Then
nHo = i
REEabsent(11) = False
REEabsent1(11) = False
End If
Next i
If nHo = 101 Then
REEabsent(11) = True
REEabsent1(11) = True
GoTo f12
End If
If DatiOrigine(NumCamp, nHo) <= 0 Then
REEabsent(11) = True
REEabsent1(11) = True
End If
f12:


'determino la colonna di Er
nEr = 101
For i = 1 To Numelem
If Elementi(i) = "Er" Then
nEr = i
REEabsent(12) = False
REEabsent1(12) = False
End If
Next i
If nEr = 101 Then
REEabsent(12) = True
REEabsent1(12) = True
GoTo f13
End If
If DatiOrigine(NumCamp, nEr) <= 0 Then
REEabsent(12) = True
REEabsent1(12) = True
End If
f13:


'determino la colonna di Tm
nTm = 101
For i = 1 To Numelem
If Elementi(i) = "Tm" Then
nTm = i
REEabsent(13) = False
REEabsent1(13) = False
End If
Next i
If nTm = 101 Then
REEabsent(13) = True
REEabsent1(13) = True
GoTo f14
End If
If DatiOrigine(NumCamp, nTm) <= 0 Then
REEabsent(13) = True
REEabsent1(13) = True
End If
f14:


'determino la colonna di Yb
nYb = 101
For i = 1 To Numelem
If Elementi(i) = "Yb" Then
nYb = i
REEabsent(14) = False
REEabsent1(14) = False
End If
Next i
If nYb = 101 Then
REEabsent(14) = True
REEabsent1(14) = True
GoTo f15
End If
If DatiOrigine(NumCamp, nYb) <= 0 Then
REEabsent(14) = True
REEabsent1(14) = True
End If
f15:


'determino la colonna di Lu
nLu = 101
For i = 1 To Numelem
If Elementi(i) = "Lu" Then
nLu = i
REEabsent(15) = False
REEabsent1(15) = False
End If
Next i
If nLu = 101 Then
REEabsent(15) = True
REEabsent1(15) = True
GoTo f16
End If
If DatiOrigine(NumCamp, nLu) <= 0 Then
REEabsent(15) = True
REEabsent1(15) = True
End If
f16:

'inserisco i dati nella matrice REE(n)

'prima valuto quali elementi posseggono il fattore di normalizzazione

For i = 1 To 15

If NormREE(i) <= 0 Then
REEabsent(i) = True
REEabsent1(i) = True
End If

Next i


'prima quelli presenti nelle analisi

'La
If REEabsent(1) = False Then
valREE(1) = DatiOrigine(NumCamp, nLa)
valREEn(1) = DatiOrigine(NumCamp, nLa) / NormREE(1)
End If
If REEabsent(1) = True Then
valREE(1) = 0
valREEn(1) = 0
End If

'Ce
If REEabsent(2) = False Then
valREE(2) = DatiOrigine(NumCamp, nCe)
valREEn(2) = DatiOrigine(NumCamp, nCe) / NormREE(2)
End If
If REEabsent(2) = True Then
valREE(2) = 0
valREEn(2) = 0
End If

'Pr
If REEabsent(3) = False Then
valREE(3) = DatiOrigine(NumCamp, nPr)
valREEn(3) = DatiOrigine(NumCamp, nPr) / NormREE(3)
End If
If REEabsent(3) = True Then
valREE(3) = 0
valREEn(3) = 0
End If

'Nd
If REEabsent(4) = False Then
valREE(4) = DatiOrigine(NumCamp, nNd)
valREEn(4) = DatiOrigine(NumCamp, nNd) / NormREE(4)
End If
If REEabsent(4) = True Then
valREE(4) = 0
valREEn(4) = 0
End If

'Pm
If REEabsent(5) = False Then
valREE(5) = DatiOrigine(NumCamp, nPm)
valREEn(5) = DatiOrigine(NumCamp, nPm) / NormREE(5)
End If
If REEabsent(5) = True Then
valREE(5) = 0
valREEn(5) = 0
End If

'Sm
If REEabsent(6) = False Then
valREE(6) = DatiOrigine(NumCamp, nSm)
valREEn(6) = DatiOrigine(NumCamp, nSm) / NormREE(6)
End If
If REEabsent(6) = True Then
valREE(6) = 0
valREEn(6) = 0
End If

'Eu
If REEabsent(7) = False Then
valREE(7) = DatiOrigine(NumCamp, nEu)
valREEn(7) = DatiOrigine(NumCamp, nEu) / NormREE(7)
End If
If REEabsent(7) = True Then
valREE(7) = 0
valREEn(7) = 0
End If

'Gd
If REEabsent(8) = False Then
valREE(8) = DatiOrigine(NumCamp, nGd)
valREEn(8) = DatiOrigine(NumCamp, nGd) / NormREE(8)
End If
If REEabsent(8) = True Then
valREE(8) = 0
valREEn(8) = 0
End If

'Tb
If REEabsent(9) = False Then
valREE(9) = DatiOrigine(NumCamp, nTb)
valREEn(9) = DatiOrigine(NumCamp, nTb) / NormREE(9)
End If
If REEabsent(9) = True Then
valREE(9) = 0
valREEn(9) = 0
End If

'Dy
If REEabsent(10) = False Then
valREE(10) = DatiOrigine(NumCamp, nDy)
valREEn(10) = DatiOrigine(NumCamp, nDy) / NormREE(10)
End If
If REEabsent(10) = True Then
valREE(10) = 0
valREEn(10) = 0
End If

'Ho
If REEabsent(11) = False Then
valREE(11) = DatiOrigine(NumCamp, nHo)
valREEn(11) = DatiOrigine(NumCamp, nHo) / NormREE(11)
End If
If REEabsent(11) = True Then
valREE(11) = 0
valREEn(11) = 0
End If

'Er
If REEabsent(12) = False Then
valREE(12) = DatiOrigine(NumCamp, nEr)
valREEn(12) = DatiOrigine(NumCamp, nEr) / NormREE(12)
End If
If REEabsent(12) = True Then
valREE(12) = 0
valREEn(12) = 0
End If

'Tm
If REEabsent(13) = False Then
valREE(13) = DatiOrigine(NumCamp, nTm)
valREEn(13) = DatiOrigine(NumCamp, nTm) / NormREE(13)
End If
If REEabsent(13) = True Then
valREE(13) = 0
valREEn(13) = 0
End If

'Yb
If REEabsent(14) = False Then
valREE(14) = DatiOrigine(NumCamp, nYb)
valREEn(14) = DatiOrigine(NumCamp, nYb) / NormREE(14)
End If
If REEabsent(14) = True Then
valREE(14) = 0
valREEn(14) = 0
End If

'Lu
If REEabsent(15) = False Then
valREE(15) = DatiOrigine(NumCamp, nLu)
valREEn(15) = DatiOrigine(NumCamp, nLu) / NormREE(15)
End If
If REEabsent(15) = True Then
valREE(15) = 0
valREEn(15) = 0
End If



'i dati non presenti in origine li interpolo


If REEabsent1(1) = True Then
    
    n1 = 0
    n2 = 0
    
    For ii = 1 To 15
    
    If n1 = 0 Then
        If REEabsent1(ii) = False Then
        n1 = ii
        GoTo ee2
        End If
    End If
    
    If n1 <> 0 Then
        If REEabsent1(ii) = False Then
        n2 = ii
        GoTo aa1
        End If
    End If
ee2:
    Next ii
    
aa1:
    
If n1 <= 0 Or n2 <= 0 Or valREEn(n1) <= 0 Or valREEn(n2) <= 0 Then
valREEn(1) = 0 ' 11-06-02
Exit Sub
End If
'----------12-06-02
logree = LOG10(valREEn(n1)) + (((LOG10(valREEn(n1)) - LOG10(valREEn(n2))) / (n2 - n1)))
valREEn(1) = EXP10(logree)
REEabsent1(1) = False

'---------
    
    
'    valREEn(1) = valREEn(n1) + ( (valREEn(n2) - valREEn(n1)) / (n2 - n1))
'    REEabsent1(1) = False
End If
    
If REEabsent1(15) = True Then
    
    n1 = 0
    n2 = 0
    
    For ii = 15 To 1 Step -1
    
    If n1 = 0 Then
        If REEabsent1(ii) = False Then
        n1 = ii
        GoTo ee1
        End If
    End If
    
    If n1 <> 0 Then
        If REEabsent1(ii) = False Then
        n2 = ii
        GoTo aa44
        End If
    End If
ee1:
    Next ii
    
aa44:

If n1 <= 0 Or n2 <= 0 Or valREEn(n1) <= 0 Or valREEn(n2) <= 0 Then
valREEn(15) = 0 ' 11-06-02
Exit Sub
End If

logree = LOG10(valREEn(n1)) - (((LOG10(valREEn(n2)) - LOG10(valREEn(n1))) / (n2 - n1)))
valREEn(15) = EXP10(logree)
REEabsent1(15) = False
    
    
'    valREEn(15) = valREEn(n2) - ((15 - n2) * (valREEn(n2) - valREEn(n1)) / (n1 - n2))
'    REEabsent1(15) = False
    
End If



For i = 1 To 15

If REEabsent1(i) = True Then


n1 = 0
n2 = 0
For ii = i To 1 Step -1
If REEabsent1(ii) = False Then
n1 = ii
GoTo aa2
End If
Next ii
aa2:

For ii = i To 15
If REEabsent1(ii) = False Then
n2 = ii
GoTo aa3
End If
Next ii
aa3:

'valREEn(i) = valREEn(n1) - (((valREEn(n1) - valREEn(n2)) / (n2 - n1)) * (i - n1))
'REEabsent1(i) = False

'---------------- 04-06-2002
If n1 <= 0 Or n2 <= 0 Or valREEn(n1) <= 0 Or valREEn(n2) <= 0 Then
Exit Sub
End If


logree = LOG10(valREEn(n1)) - (((LOG10(valREEn(n1)) - LOG10(valREEn(n2))) / (n2 - n1)) * (i - n1))
valREEn(i) = EXP10(logree)
REEabsent1(i) = False
'-----------------

End If

Next i

GoTo ret1
ret:
MsgBox "An Error Occurred:dello REE-spider failed", , "Attenzione"
ret1:


End Sub


Public Sub DeterminaValoriREExEu(NumCamp)

On Error GoTo ret

For i = 1 To 15
REEabsent(i) = True
REEabsent1(i) = True
Next i


'determino la colonna di la
nLa = 101
For i = 1 To Numelem
If Elementi(i) = "La" Then
nLa = i
REEabsent(1) = False
REEabsent1(1) = False
End If
Next i
If nLa = 101 Then
REEabsent(1) = True
REEabsent1(1) = True
GoTo f1
End If
If DatiOrigine(NumCamp, nLa) <= 0 Then
REEabsent(1) = True
REEabsent1(1) = True
End If
f1:

'determino la colonna di Ce
nCe = 101
For i = 1 To Numelem
If Elementi(i) = "Ce" Then
nCe = i
REEabsent(2) = False
REEabsent1(2) = False
End If
Next i
If nCe = 101 Then
REEabsent(2) = True
REEabsent1(2) = True
GoTo f2
End If
If DatiOrigine(NumCamp, nCe) <= 0 Then
REEabsent(2) = True
REEabsent1(2) = True
End If
f2:


'determino la colonna di Pr
nPr = 101
For i = 1 To Numelem
If Elementi(i) = "Pr" Then
nPr = i
REEabsent(3) = False
REEabsent1(3) = False
End If
Next i
If nPr = 101 Then
REEabsent(3) = True
REEabsent1(3) = True
GoTo f3
End If
If DatiOrigine(NumCamp, nPr) <= 0 Then
REEabsent(3) = True
REEabsent1(3) = True
End If
f3:


'determino la colonna di Nd
nNd = 101
For i = 1 To Numelem
If Elementi(i) = "Nd" Then
nNd = i
REEabsent(4) = False
REEabsent1(4) = False
End If
Next i
If nNd = 101 Then
REEabsent(4) = True
REEabsent1(4) = True
GoTo f4
End If
If DatiOrigine(NumCamp, nNd) <= 0 Then
REEabsent(4) = True
REEabsent1(4) = True
End If
f4:


'determino la colonna di Pm
nPm = 101
For i = 1 To Numelem
If Elementi(i) = "Pm" Then
nPm = i
REEabsent(5) = False
REEabsent1(5) = False
End If
Next i
If nPm = 101 Then
REEabsent(5) = True
REEabsent1(5) = True
GoTo f5
End If
If DatiOrigine(NumCamp, nPm) <= 0 Then
REEabsent(5) = True
REEabsent1(5) = True
End If
f5:


'determino la colonna di Sm
nSm = 101
For i = 1 To Numelem
If Elementi(i) = "Sm" Then
nSm = i
REEabsent(6) = False
REEabsent1(6) = False
End If
Next i
If nSm = 101 Then
REEabsent(6) = True
REEabsent1(6) = True
GoTo f6
End If
If DatiOrigine(NumCamp, nSm) <= 0 Then
REEabsent(6) = True
REEabsent1(6) = True
End If
f6:


'determino la colonna di Eu
nEu = 101
For i = 1 To Numelem
If Elementi(i) = "Eu" Then
nEu = i
REEabsent(7) = False
REEabsent1(7) = False
End If
Next i
If nEu = 101 Then
REEabsent(7) = True
REEabsent1(7) = True
GoTo f7
End If
If DatiOrigine(NumCamp, nEu) <= 0 Then
REEabsent(7) = True
REEabsent1(7) = True
End If
f7:


'determino la colonna di Gd
nGd = 101
For i = 1 To Numelem
If Elementi(i) = "Gd" Then
nGd = i
REEabsent(8) = False
REEabsent1(8) = False
End If
Next i
If nGd = 101 Then
REEabsent(8) = True
REEabsent1(8) = True
GoTo f8
End If
If DatiOrigine(NumCamp, nGd) <= 0 Then
REEabsent(8) = True
REEabsent1(8) = True
End If
f8:


'determino la colonna di Tb
nTb = 101
For i = 1 To Numelem
If Elementi(i) = "Tb" Then
nTb = i
REEabsent(9) = False
REEabsent1(9) = False
End If
Next i
If nTb = 101 Then
REEabsent(9) = True
REEabsent1(9) = True
GoTo f9
End If
If DatiOrigine(NumCamp, nTb) <= 0 Then
REEabsent(9) = True
REEabsent1(9) = True
End If
f9:


'determino la colonna di Dy
nDy = 101
For i = 1 To Numelem
If Elementi(i) = "Dy" Then
nDy = i
REEabsent(10) = False
REEabsent1(10) = False
End If
Next i
If nDy = 101 Then
REEabsent(10) = True
REEabsent1(10) = True
GoTo f11
End If
If DatiOrigine(NumCamp, nDy) <= 0 Then
REEabsent(10) = True
REEabsent1(10) = True
End If
f11:


'determino la colonna di Ho
nHo = 101
For i = 1 To Numelem
If Elementi(i) = "Ho" Then
nHo = i
REEabsent(11) = False
REEabsent1(11) = False
End If
Next i
If nHo = 101 Then
REEabsent(11) = True
REEabsent1(11) = True
GoTo f12
End If
If DatiOrigine(NumCamp, nHo) <= 0 Then
REEabsent(11) = True
REEabsent1(11) = True
End If
f12:


'determino la colonna di Er
nEr = 101
For i = 1 To Numelem
If Elementi(i) = "Er" Then
nEr = i
REEabsent(12) = False
REEabsent1(12) = False
End If
Next i
If nEr = 101 Then
REEabsent(12) = True
REEabsent1(12) = True
GoTo f13
End If
If DatiOrigine(NumCamp, nEr) <= 0 Then
REEabsent(12) = True
REEabsent1(12) = True
End If
f13:


'determino la colonna di Tm
nTm = 101
For i = 1 To Numelem
If Elementi(i) = "Tm" Then
nTm = i
REEabsent(13) = False
REEabsent1(13) = False
End If
Next i
If nTm = 101 Then
REEabsent(13) = True
REEabsent1(13) = True
GoTo f14
End If
If DatiOrigine(NumCamp, nTm) <= 0 Then
REEabsent(13) = True
REEabsent1(13) = True
End If
f14:


'determino la colonna di Yb
nYb = 101
For i = 1 To Numelem
If Elementi(i) = "Yb" Then
nYb = i
REEabsent(14) = False
REEabsent1(14) = False
End If
Next i
If nYb = 101 Then
REEabsent(14) = True
REEabsent1(14) = True
GoTo f15
End If
If DatiOrigine(NumCamp, nYb) <= 0 Then
REEabsent(14) = True
REEabsent1(14) = True
End If
f15:


'determino la colonna di Lu
nLu = 101
For i = 1 To Numelem
If Elementi(i) = "Lu" Then
nLu = i
REEabsent(15) = False
REEabsent1(15) = False
End If
Next i
If nLu = 101 Then
REEabsent(15) = True
REEabsent1(15) = True
GoTo f16
End If
If DatiOrigine(NumCamp, nLu) <= 0 Then
REEabsent(15) = True
REEabsent1(15) = True
End If
f16:

'inserisco i dati nella matrice REE(n)

'prima valuto quali elementi posseggono il fattore di normalizzazione

For i = 1 To 15

If NormREE(i) <= 0 Then
REEabsent(i) = True
REEabsent1(i) = True
End If

Next i


'prima quelli presenti nelle analisi



'Sm
If REEabsent(6) = False Then
valREE(6) = DatiOrigine(NumCamp, nSm)
valREEn(6) = DatiOrigine(NumCamp, nSm) / NormREE(6)
End If
If REEabsent(6) = True Then
valREE(6) = 0
valREEn(6) = 0
End If

'Eu
If REEabsent(7) = False Then
valREE(7) = DatiOrigine(NumCamp, nEu)
valREEn(7) = DatiOrigine(NumCamp, nEu) / NormREE(7)
End If
If REEabsent(7) = True Then
valREE(7) = 0
valREEn(7) = 0
End If

'Gd
If REEabsent(8) = False Then
valREE(8) = DatiOrigine(NumCamp, nGd)
valREEn(8) = DatiOrigine(NumCamp, nGd) / NormREE(8)
End If
If REEabsent(8) = True Then
valREE(8) = 0
valREEn(8) = 0
End If

'Tb
If REEabsent(9) = False Then
valREE(9) = DatiOrigine(NumCamp, nTb)
valREEn(9) = DatiOrigine(NumCamp, nTb) / NormREE(9)
End If
If REEabsent(9) = True Then
valREE(9) = 0
valREEn(9) = 0
End If



'Yb
If REEabsent(14) = False Then
valREE(14) = DatiOrigine(NumCamp, nYb)
valREEn(14) = DatiOrigine(NumCamp, nYb) / NormREE(14)
End If
If REEabsent(14) = True Then
valREE(14) = 0
valREEn(14) = 0
End If




'Verifico che siano presenti gli analiti necessari
If REEabsent(6) = True Then
valREEn(6) = -123456.7
Exit Sub
End If
If REEabsent(7) = True Then
valREEn(7) = -123456.7
Exit Sub
End If

If REEabsent(8) = True Then

If REEabsent(9) = True Then
valREEn(8) = -123456.7
Exit Sub
End If
If REEabsent(14) = True Then
valREEn(8) = -123456.7
Exit Sub
End If
'se Tb e Yb sono presenti interpolo
logree = LOG10(valREEn(9)) + (((LOG10(valREEn(9)) - LOG10(valREEn(14))) / (14 - 9)))
valREEn(8) = EXP10(logree)
REEabsent(8) = False

End If



GoTo ret1
ret:
MsgBox "An Error Occurred:dello REE-spider failed", , "Attenzione"
ret1:


End Sub


Public Sub DeterminaValoriREEmod(NumMod)

On Error GoTo ret

For i = 1 To 15
REEabsent(i) = True
REEabsent1(i) = True
Next i



'determino la colonna di la
nLa = 101
For i = 1 To Numelem
If Elementi(i) = "La" Then
nLa = i
REEabsent(1) = False
REEabsent1(1) = False
End If
Next i
If nLa = 101 Then
REEabsent(1) = True
REEabsent1(1) = True
GoTo f1
End If

f1:

'determino la colonna di Ce
nCe = 101
For i = 1 To Numelem
If Elementi(i) = "Ce" Then
nCe = i
REEabsent(2) = False
REEabsent1(2) = False
End If
Next i
If nCe = 101 Then
REEabsent(2) = True
REEabsent1(2) = True
GoTo f2
End If

f2:


'determino la colonna di Pr
nPr = 101
For i = 1 To Numelem
If Elementi(i) = "Pr" Then
nPr = i
REEabsent(3) = False
REEabsent1(3) = False
End If
Next i
If nPr = 101 Then
REEabsent(3) = True
REEabsent1(3) = True
GoTo f3
End If

f3:


'determino la colonna di Nd
nNd = 101
For i = 1 To Numelem
If Elementi(i) = "Nd" Then
nNd = i
REEabsent(4) = False
REEabsent1(4) = False
End If
Next i
If nNd = 101 Then
REEabsent(4) = True
REEabsent1(4) = True
GoTo f4
End If

f4:


'determino la colonna di Pm
nPm = 101
For i = 1 To Numelem
If Elementi(i) = "Pm" Then
nPm = i
REEabsent(5) = False
REEabsent1(5) = False
End If
Next i
If nPm = 101 Then
REEabsent(5) = True
REEabsent1(5) = True
GoTo f5
End If

f5:


'determino la colonna di Sm
nSm = 101
For i = 1 To Numelem
If Elementi(i) = "Sm" Then
nSm = i
REEabsent(6) = False
REEabsent1(6) = False
End If
Next i
If nSm = 101 Then
REEabsent(6) = True
REEabsent1(6) = True
GoTo f6
End If

f6:


'determino la colonna di Eu
nEu = 101
For i = 1 To Numelem
If Elementi(i) = "Eu" Then
nEu = i
REEabsent(7) = False
REEabsent1(7) = False
End If
Next i
If nEu = 101 Then
REEabsent(7) = True
REEabsent1(7) = True
GoTo f7
End If

f7:


'determino la colonna di Gd
nGd = 101
For i = 1 To Numelem
If Elementi(i) = "Gd" Then
nGd = i
REEabsent(8) = False
REEabsent1(8) = False
End If
Next i
If nGd = 101 Then
REEabsent(8) = True
REEabsent1(8) = True
GoTo f8
End If

f8:


'determino la colonna di Tb
nTb = 101
For i = 1 To Numelem
If Elementi(i) = "Tb" Then
nTb = i
REEabsent(9) = False
REEabsent1(9) = False
End If
Next i
If nTb = 101 Then
REEabsent(9) = True
REEabsent1(9) = True
GoTo f9
End If


f9:


'determino la colonna di Dy
nDy = 101
For i = 1 To Numelem
If Elementi(i) = "Dy" Then
nDy = i
REEabsent(10) = False
REEabsent1(10) = False
End If
Next i
If nDy = 101 Then
REEabsent(10) = True
REEabsent1(10) = True
GoTo f11
End If

f11:


'determino la colonna di Ho
nHo = 101
For i = 1 To Numelem
If Elementi(i) = "Ho" Then
nHo = i
REEabsent(11) = False
REEabsent1(11) = False
End If
Next i
If nHo = 101 Then
REEabsent(11) = True
REEabsent1(11) = True
GoTo f12
End If

f12:


'determino la colonna di Er
nEr = 101
For i = 1 To Numelem
If Elementi(i) = "Er" Then
nEr = i
REEabsent(12) = False
REEabsent1(12) = False
End If
Next i
If nEr = 101 Then
REEabsent(12) = True
REEabsent1(12) = True
GoTo f13
End If

f13:


'determino la colonna di Tm
nTm = 101
For i = 1 To Numelem
If Elementi(i) = "Tm" Then
nTm = i
REEabsent(13) = False
REEabsent1(13) = False
End If
Next i
If nTm = 101 Then
REEabsent(13) = True
REEabsent1(13) = True
GoTo f14
End If

f14:


'determino la colonna di Yb
nYb = 101
For i = 1 To Numelem
If Elementi(i) = "Yb" Then
nYb = i
REEabsent(14) = False
REEabsent1(14) = False
End If
Next i
If nYb = 101 Then
REEabsent(14) = True
REEabsent1(14) = True
GoTo f15
End If

f15:


'determino la colonna di Lu
nLu = 101
For i = 1 To Numelem
If Elementi(i) = "Lu" Then
nLu = i
REEabsent(15) = False
REEabsent1(15) = False
End If
Next i
If nLu = 101 Then
REEabsent(15) = True
REEabsent1(15) = True
GoTo f16
End If

f16:

'inserisco i dati nella matrice REE(n)

'prima valuto quali elementi posseggono il fattore di normalizzazione

For i = 1 To 15

If NormREE(i) <= 0 Then
REEabsent(i) = True
REEabsent1(i) = True
End If

Next i

Dim datiree(15)

'----------------------------
Close #1
Open App.Path + "\data\SpiMod_" + Trim(NumMod) + ".txt" For Input As #1

Input #1, numgraph, C0, F, ModelLineSp, col2, tipo, ModelSymbSp, col1, ModelSymbWid

While Not EOF(1)

Input #1, ss, valss

For ii = 1 To 15



If ss = REE(ii) Then
datiree(ii) = valss
If valss <= 0 Then
REEabsent(ii) = True
REEabsent1(ii) = True
End If

End If


Next ii


Wend


'------------------------------
'prima quelli presenti nelle analisi

'La
If REEabsent(1) = False Then
valREE(1) = datiree(1)
valREEn(1) = datiree(1) / NormREE(1)
End If
If REEabsent(1) = True Then
valREE(1) = 0
valREEn(1) = 0
End If

'Ce
If REEabsent(2) = False Then
valREE(2) = datiree(2)
valREEn(2) = datiree(2) / NormREE(2)
End If
If REEabsent(2) = True Then
valREE(2) = 0
valREEn(2) = 0
End If

'Pr
If REEabsent(3) = False Then
valREE(3) = datiree(3)
valREEn(3) = datiree(3) / NormREE(3)
End If
If REEabsent(3) = True Then
valREE(3) = 0
valREEn(3) = 0
End If

'Nd
If REEabsent(4) = False Then
valREE(4) = datiree(4)
valREEn(4) = datiree(4) / NormREE(4)
End If
If REEabsent(4) = True Then
valREE(4) = 0
valREEn(4) = 0
End If

'Pm
If REEabsent(5) = False Then
valREE(5) = datiree(5)
valREEn(5) = datiree(5) / NormREE(5)
End If
If REEabsent(5) = True Then
valREE(5) = 0
valREEn(5) = 0
End If

'Sm
If REEabsent(6) = False Then
valREE(6) = datiree(6)
valREEn(6) = datiree(6) / NormREE(6)
End If
If REEabsent(6) = True Then
valREE(6) = 0
valREEn(6) = 0
End If

'Eu
If REEabsent(7) = False Then
valREE(7) = datiree(7)
valREEn(7) = datiree(7) / NormREE(7)
End If
If REEabsent(7) = True Then
valREE(7) = 0
valREEn(7) = 0
End If

'Gd
If REEabsent(8) = False Then
valREE(8) = datiree(8)
valREEn(8) = datiree(8) / NormREE(8)
End If
If REEabsent(8) = True Then
valREE(8) = 0
valREEn(8) = 0
End If

'Tb
If REEabsent(9) = False Then
valREE(9) = datiree(9)
valREEn(9) = datiree(9) / NormREE(9)
End If
If REEabsent(9) = True Then
valREE(9) = 0
valREEn(9) = 0
End If

'Dy
If REEabsent(10) = False Then
valREE(10) = datiree(10)
valREEn(10) = datiree(10) / NormREE(10)
End If
If REEabsent(10) = True Then
valREE(10) = 0
valREEn(10) = 0
End If

'Ho
If REEabsent(11) = False Then
valREE(11) = datiree(11)
valREEn(11) = datiree(11) / NormREE(11)
End If
If REEabsent(11) = True Then
valREE(11) = 0
valREEn(11) = 0
End If

'Er
If REEabsent(12) = False Then
valREE(12) = datiree(12)
valREEn(12) = datiree(12) / NormREE(12)
End If
If REEabsent(12) = True Then
valREE(12) = 0
valREEn(12) = 0
End If

'Tm
If REEabsent(13) = False Then
valREE(13) = datiree(13)
valREEn(13) = datiree(13) / NormREE(13)
End If
If REEabsent(13) = True Then
valREE(13) = 0
valREEn(13) = 0
End If

'Yb
If REEabsent(14) = False Then
valREE(14) = datiree(14)
valREEn(14) = datiree(14) / NormREE(14)
End If
If REEabsent(14) = True Then
valREE(14) = 0
valREEn(14) = 0
End If

'Lu
If REEabsent(15) = False Then
valREE(15) = datiree(15)
valREEn(15) = datiree(15) / NormREE(15)
End If
If REEabsent(15) = True Then
valREE(15) = 0
valREEn(15) = 0
End If



'i dati non presenti in origine li interpolo


If REEabsent1(1) = True Then
    
    n1 = 0
    n2 = 0
    
    For ii = 1 To 15
    
    If n1 = 0 Then
        If REEabsent1(ii) = False Then
        n1 = ii
        GoTo ee2
        End If
    End If
    
    If n1 <> 0 Then
        If REEabsent1(ii) = False Then
        n2 = ii
        GoTo aa1
        End If
    End If
ee2:
    Next ii
    
aa1:
    
If n1 <= 0 Or n2 <= 0 Or valREEn(n1) <= 0 Or valREEn(n2) <= 0 Then
valREEn(1) = 0 ' 11-06-02
Exit Sub
End If
'----------12-06-02
logree = LOG10(valREEn(n1)) + (((LOG10(valREEn(n1)) - LOG10(valREEn(n2))) / (n2 - n1)))
valREEn(1) = EXP10(logree)
REEabsent1(1) = False

'---------
    
    
'    valREEn(1) = valREEn(n1) + ( (valREEn(n2) - valREEn(n1)) / (n2 - n1))
'    REEabsent1(1) = False
End If
    
If REEabsent1(15) = True Then
    
    n1 = 0
    n2 = 0
    
    For ii = 15 To 1 Step -1
    
    If n1 = 0 Then
        If REEabsent1(ii) = False Then
        n1 = ii
        GoTo ee1
        End If
    End If
    
    If n1 <> 0 Then
        If REEabsent1(ii) = False Then
        n2 = ii
        GoTo aa44
        End If
    End If
ee1:
    Next ii
    
aa44:

If n1 <= 0 Or n2 <= 0 Or valREEn(n1) <= 0 Or valREEn(n2) <= 0 Then
valREEn(15) = 0 ' 11-06-02
Exit Sub
End If

logree = LOG10(valREEn(n1)) - (((LOG10(valREEn(n2)) - LOG10(valREEn(n1))) / (n2 - n1)))
valREEn(15) = EXP10(logree)
REEabsent1(15) = False
    
    
'    valREEn(15) = valREEn(n2) - ((15 - n2) * (valREEn(n2) - valREEn(n1)) / (n1 - n2))
'    REEabsent1(15) = False
    
End If



For i = 1 To 15

If REEabsent1(i) = True Then


n1 = 0
n2 = 0
For ii = i To 1 Step -1
If REEabsent1(ii) = False Then
n1 = ii
GoTo aa2
End If
Next ii
aa2:

For ii = i To 15
If REEabsent1(ii) = False Then
n2 = ii
GoTo aa3
End If
Next ii
aa3:

'valREEn(i) = valREEn(n1) - (((valREEn(n1) - valREEn(n2)) / (n2 - n1)) * (i - n1))
'REEabsent1(i) = False

'---------------- 04-06-2002
If n1 <= 0 Or n2 <= 0 Or valREEn(n1) <= 0 Or valREEn(n2) <= 0 Then
Exit Sub
End If


logree = LOG10(valREEn(n1)) - (((LOG10(valREEn(n1)) - LOG10(valREEn(n2))) / (n2 - n1)) * (i - n1))
valREEn(i) = EXP10(logree)
REEabsent1(i) = False
'-----------------

End If

Next i

GoTo ret1
ret:
MsgBox "An Error Occurred:dello REE-spider failed", , "Attenzione"
ret1:


End Sub

Public Sub RapportiREE(Elem1 As String)



SPI.DeterminaREEPresenti



If Elem1 = "LaSm" Then

Numelem = Numelem + 1
For i = 1 To Numcamp1
SPI.DeterminaValoriREE i
If valREEn(6) <= 0 Or valREEn(1) <= 0 Then
DatiOrigine(i, Numelem) = -12345.67
GoTo poi1:
End If
DatiOrigine(i, Numelem) = valREEn(1) / valREEn(6)
DatiOrigine(ii, Numelem) = Val(Format$(DatiOrigine(ii, Numelem), "0.00000000000"))
poi1:
Next i
Elementi(Numelem) = "(La/Sm)N"
End If

If Elem1 = "LaYb" Then
Numelem = Numelem + 1
For i = 1 To Numcamp1
SPI.DeterminaValoriREE i
If valREEn(14) <= 0 Or valREEn(1) <= 0 Then
DatiOrigine(i, Numelem) = -12345.67
GoTo poi2:
End If
DatiOrigine(i, Numelem) = valREEn(1) / valREEn(14)
DatiOrigine(ii, Numelem) = Val(Format$(DatiOrigine(ii, Numelem), "0.00000000000"))
poi2:
Next i
Elementi(Numelem) = "(La/Yb)N"
End If


If Elem1 = "TbYb" Then
Numelem = Numelem + 1
For i = 1 To Numcamp1
SPI.DeterminaValoriREE i
If valREEn(9) <= 0 Or valREEn(14) <= 0 Then
DatiOrigine(i, Numelem) = -12345.67
GoTo poi3:
End If
DatiOrigine(i, Numelem) = valREEn(9) / valREEn(14)
DatiOrigine(ii, Numelem) = Val(Format$(DatiOrigine(ii, Numelem), "0.00000000000"))
poi3:
Next i
Elementi(Numelem) = "(Tb/Yb)N"
End If
End Sub

