VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObject END Attribute VB_Name = "CIPW" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = False Private ErrorNorm As Boolean Private BaAbsent As Boolean Private ZrAbsent As Boolean Private SrAbsent As Boolean Private CrAbsent As Boolean Private FAbsent As Boolean Private PAbsent As Boolean Private SAbsent As Boolean Private CO2Absent As Boolean Private NiAbsent As Boolean Private WFeO As Single Private WMnO As Single Private WNiO As Single Private WCaO As Single Private WBaO As Single Private WSrO As Single Private WP2O5 As Single Private WS As Single Private WCr2O3 As Single Private WCO2 As Single Private WZrO2 As Single Private WSiO2 As Single Private WTiO2 As Single Private WK2O As Single Private WAl2O3 As Single Private WNa2O As Single Private WFe2O3 As Single Private WF As Single Private WMgO As Single Private MFeO As Single Private MMnO As Single Private MNiO As Single Private MCaO As Single Private MBaO As Single Private MSrO As Single Private MP2O5 As Single Private MS As Single Private MCr2O3 As Single Private MCO2 As Single Private MZrO2 As Single Private MSiO2 As Single Private MTiO2 As Single Private MK2O As Single Private MAl2O3 As Single Private MNa2O As Single Private MFe2O3 As Single Private MF As Single Private MMgO As Single Private nFeO As Integer Private nMnO As Integer Private nNiO As Integer Private nCaO As Integer Private nBaO As Integer Private nSrO As Integer Private nP2O5 As Integer Private nS As Integer Private nCr2O3 As Integer Private nCO2 As Integer Private nZrO2 As Integer Private nSiO2 As Integer Private nTiO2 As Integer Private nK2O As Integer Private nAl2O3 As Integer Private nNa2O As Integer Private nFe2O3 As Integer Private nF As Single Private nMgO As Single Public Apatite Public Pyrite Public Chromite Public Fluorite Public Calcite Public Zircon Public Ilmenite Public Sphene Public Orthoclase Public Albite Public Aegerine Public Anorthite Public Corundum Public Magnetite Public Hematite Public Diopside Public Hypersthene Public Wollastonite Public Quartz Public Olivine Public Perovskite Public Rutile Public Nepheline Public Leucite Public Calcium_Orthosilicate Public Kaliophilite Public Na2SiO3 Public K_meta Sub Norm() On Error GoTo rety WFeO = 71.85 WMnO = 70.94 WNiO = 74.7 WCaO = 56.08 WBaO = 153.33 WSrO = 103.62 WP2O5 = 141.95 WS = 32.06 WCr2O3 = 152.02 WCO2 = 44.01 WZrO2 = 123.22 WSiO2 = 60.0843 WTiO2 = 79.87 WK2O = 94.2 WAl2O3 = 101.96 WNa2O = 61.98 WFe2O3 = 159.6922 '159.69 WF = 19 WMgO = 40.31 BaAbsent = False ZrAbsent = False SrAbsent = False CrAbsent = False FAbsent = False PAbsent = False SAbsent = False CO2Absent = False NiAbsent = False ErrorNorm = False 'determino la colonna di FeO nFeO = 101 For i = 1 To Numelem If Elementi(i) = "FeO" Then nFeO = i End If Next i If nFeO = 101 Then ErrorNorm = True GoTo errorTrue End If 'determino la colonna di MnO nMnO = 101 For i = 1 To Numelem If Elementi(i) = "MnO" Then nMnO = i End If Next i If nMnO = 101 Then ErrorNorm = True GoTo errorTrue End If 'determino la colonna di MgO nMgO = 101 For i = 1 To Numelem If Elementi(i) = "MgO" Then nMgO = i End If Next i If nMgO = 101 Then ErrorNorm = True GoTo errorTrue End If 'determino la colonna di NiO nNiO = 101 For i = 1 To Numelem If Elementi(i) = "Ni" Then nNiO = i End If Next i If nNiO = 101 Then NiAbsent = True End If 'determino la colonna di CaO nCaO = 101 For i = 1 To Numelem If Elementi(i) = "CaO" Then nCaO = i End If Next i If nCaO = 101 Then ErrorNorm = True GoTo errorTrue End If 'determino la colonna di BaO ppm nBaO = 101 For i = 1 To Numelem If Elementi(i) = "Ba" Then nBaO = i End If Next i If nBaO = 101 Then BaAbsent = True End If 'determino la colonna di SrO ppm nSrO = 101 For i = 1 To Numelem If Elementi(i) = "Sr" Then nSrO = i End If Next i If nSrO = 101 Then SrAbsent = True End If 'determino la colonna di P2O5 nP2O5 = 101 For i = 1 To Numelem If Elementi(i) = "P2O5" Then nP2O5 = i End If Next i If nP2O5 = 101 Then PAbsent = True End If 'determino la colonna di S nS = 101 For i = 1 To Numelem If Elementi(i) = "S" Then nS = i End If Next i If nS = 101 Then SAbsent = True End If 'determino la colonna di Cr2O3 nCr2O3 = 101 For i = 1 To Numelem If Elementi(i) = "Cr" Then nCr2O3 = i End If Next i If nCr2O3 = 101 Then CrAbsent = True End If 'determino la colonna di CO2 nCO2 = 101 For i = 1 To Numelem If Elementi(i) = "CO2" Then nCO2 = i End If Next i If nCO2 = 101 Then CO2Absent = True End If 'determino la colonna di ZrO2 ppm nZrO2 = 101 For i = 1 To Numelem If Elementi(i) = "Zr" Then nZrO2 = i End If Next i If nZrO2 = 101 Then ZrAbsent = True End If 'determino la colonna di SiO2 nSiO2 = 101 For i = 1 To Numelem If Elementi(i) = "SiO2" Then nSiO2 = i End If Next i If nSiO2 = 101 Then ErrorNorm = True GoTo errorTrue End If 'determino la colonna di TiO2 nTiO2 = 101 For i = 1 To Numelem If Elementi(i) = "TiO2" Then nTiO2 = i End If Next i If nTiO2 = 101 Then ErrorNorm = True GoTo errorTrue End If 'determino la colonna di K2O nK2O = 101 For i = 1 To Numelem If Elementi(i) = "K2O" Then nK2O = i End If Next i If nK2O = 101 Then ErrorNorm = True GoTo errorTrue End If 'determino la colonna di Al2O3 nAl2O3 = 101 For i = 1 To Numelem If Elementi(i) = "Al2O3" Then nAl2O3 = i End If Next i If nAl2O3 = 101 Then 'ErrorNorm = True 'GoTo errorTrue End If 'determino la colonna di Na2O nNa2O = 101 For i = 1 To Numelem If Elementi(i) = "Na2O" Then nNa2O = i End If Next i If nNa2O = 101 Then 'ErrorNorm = True 'GoTo errorTrue End If 'determino la colonna di Fe2O3 nFe2O3 = 101 For i = 1 To Numelem If Elementi(i) = "Fe2O3" Then nFe2O3 = i End If Next i If nFe2O3 = 101 Then ErrorNorm = True GoTo errorTrue End If 'determino la colonna di F nF = 101 For i = 1 To Numelem If Elementi(i) = "F" Then nF = i End If Next i If nF = 101 Then FAbsent = True End If 'inserisco i nomi dei minerali nel form 7 Form7.Fl2.Row = 0 Form7.Fl2.col = 1 Form7.Fl2.Text = "Apatite" ElemenCIPW(1) = "Apatite" Form7.Fl2.col = 2 Form7.Fl2.Text = "Pyrite" ElemenCIPW(2) = "Pyrite" Form7.Fl2.col = 3 Form7.Fl2.Text = "Chromite" ElemenCIPW(3) = "Chromite" Form7.Fl2.col = 4 Form7.Fl2.Text = "Fluorite" ElemenCIPW(4) = "Fluorite" Form7.Fl2.col = 5 Form7.Fl2.Text = "Calcite" ElemenCIPW(5) = "Calcite" Form7.Fl2.col = 6 Form7.Fl2.Text = "Zircon" ElemenCIPW(6) = "Zircon" Form7.Fl2.col = 7 Form7.Fl2.Text = "Ilmenite" ElemenCIPW(7) = "Ilmenite" Form7.Fl2.col = 8 Form7.Fl2.Text = "Sphene" ElemenCIPW(8) = "Sphene" Form7.Fl2.col = 9 Form7.Fl2.Text = "Orthoclase" ElemenCIPW(9) = "Orthoclase" Form7.Fl2.col = 10 Form7.Fl2.Text = "Albite" ElemenCIPW(10) = "Albite" Form7.Fl2.col = 11 Form7.Fl2.Text = "Aegerine" ElemenCIPW(11) = "Aegerine" Form7.Fl2.col = 12 Form7.Fl2.Text = "Anorthite" ElemenCIPW(12) = "Anorthite" Form7.Fl2.col = 13 Form7.Fl2.Text = "Corundum" ElemenCIPW(13) = "Corundum" Form7.Fl2.col = 14 Form7.Fl2.Text = "Magnetite" ElemenCIPW(14) = "Magnetite" Form7.Fl2.col = 15 Form7.Fl2.Text = "Hematite" ElemenCIPW(15) = "Hematite" Form7.Fl2.col = 16 Form7.Fl2.Text = "Diopside" ElemenCIPW(16) = "Diopside" Form7.Fl2.col = 17 Form7.Fl2.Text = "Hypersthene" ElemenCIPW(17) = "Hypersthene" Form7.Fl2.col = 18 Form7.Fl2.Text = "Wollastonite" ElemenCIPW(18) = "Wollastonite" Form7.Fl2.col = 19 Form7.Fl2.Text = "Quartz" ElemenCIPW(19) = "Quartz" Form7.Fl2.col = 20 Form7.Fl2.Text = "Olivine" ElemenCIPW(20) = "Olivine" Form7.Fl2.col = 21 Form7.Fl2.Text = "Perovskite" ElemenCIPW(21) = "Perovskite" Form7.Fl2.col = 22 Form7.Fl2.Text = "Rutile" ElemenCIPW(22) = "Rutile" Form7.Fl2.col = 23 Form7.Fl2.Text = "Nepheline" ElemenCIPW(23) = "Nepheline" Form7.Fl2.col = 24 Form7.Fl2.Text = "Leucite" ElemenCIPW(24) = "Leucite" Form7.Fl2.col = 25 Form7.Fl2.Text = "Ca_Orthosilic" ElemenCIPW(25) = "Ca_Orthosilic" Form7.Fl2.col = 26 Form7.Fl2.Text = "Kaliophilite" ElemenCIPW(26) = "Kaliophilite" Form7.Fl2.col = 27 Form7.Fl2.Text = "Na2SiO3" ElemenCIPW(27) = "Na2SiO3" Form7.Fl2.col = 28 Form7.Fl2.Text = "K_meta" ElemenCIPW(28) = "K_meta" Form7.Fl2.col = 29 Form7.Fl2.Text = "Acmite" ElemenCIPW(28) = "Acmite" Form7.Fl2.col = 30 Form7.Fl2.Text = "wt%_Oxides" ElemenCIPW(28) = "wt%_Oxides" Form7.Fl2.col = 31 Form7.Fl2.Text = "wt%_Phases" ElemenCIPW(28) = "wt%_Phases" Form7.Fl2.col = 32 Form7.Fl2.Text = "Ox-Ph" ElemenCIPW(28) = "Ox-Ph" For i = 1 To Numcamp1 Apatite = 0 Pyrite = 0 Chromite = 0 Fluorite = 0 Calcite = 0 Zircon = 0 Ilmenite = 0 Sphene = 0 Orthoclase = 0 Albite = 0 Aegerine = 0 Anorthite = 0 Corundum = 0 Magnetite = 0 Hematite = 0 Diopside = 0 Hypersthene = 0 Wollastonite = 0 Quartz = 0 Olivine = 0 Perovskite = 0 Rutile = 0 Nepheline = 0 Leucite = 0 Calcium_Orthosilicate = 0 Kaliophilite = 0 Na2SiO3 = 0 K_meta = 0 Acmite = 0 P_Apatite = 0 P_Pyrite = 0 P_Chromite = 0 P_Fluorite = 0 P_Calcite = 0 P_Zircon = 0 P_Ilmenite = 0 P_sphene = 0 P_Orthoclase = 0 P_Albite = 0 P_Aegerine = 0 P_Anorthite = 0 P_Corundum = 0 P_Magnetite = 0 P_Hematite = 0 P_Diopside = 0 P_Hypersthene = 0 P_Wollastonite = 0 P_Quartz = 0 P_Olivine = 0 P_Perovskite = 0 P_Rutile = 0 P_Nepheline = 0 P_Leucite = 0 P_Calcium_Orthosilicate = 0 P_Kaliophilite = 0 P_Na2SiO3 = 0 P_K_meta = 0 MFeO = DatiOrigine(i, nFeO) If MFeO < 0 Then MFeO = 0 End If MMnO = DatiOrigine(i, nMnO) If MMnO < 0 Then MMnO = 0 End If If NiAbsent = True Then MNiO = 0 GoTo rr00 End If MNiO = DatiOrigine(i, nNiO) If MNiO < 0 Then MNiO = 0 End If rr00: MCaO = DatiOrigine(i, nCaO) If MCaO < 0 Then MCaO = 0 End If If BaAbsent = True Then MBaO = 0 GoTo rr1 End If MBaO = DatiOrigine(i, nBaO) If MBaO < 0 Then MBaO = 0 End If rr1: If SrAbsent = True Then MSrO = 0 GoTo rr2 End If MSrO = DatiOrigine(i, nSrO) If MSrO < 0 Then MSrO = 0 End If rr2: If PAbsent = True Then MP2O5 = 0 GoTo rr3 End If MP2O5 = DatiOrigine(i, nP2O5) If MP2O5 < 0 Then MP2O5 = 0 End If rr3: If SAbsent = True Then MS = 0 GoTo rr4 End If MS = DatiOrigine(i, nS) If MS < 0 Then MS = 0 End If rr4: If CrAbsent = True Then MCr2O3 = 0 GoTo rr5 End If MCr2O3 = DatiOrigine(i, nCr2O3) If MCr2O3 < 0 Then MCr2O3 = 0 End If rr5: If CO2Absent = True Then MCO2 = 0 GoTo rr6 End If MCO2 = DatiOrigine(i, nCO2) If MCO2 < 0 Then MCO2 = 0 End If rr6: If ZrAbsent = True Then MZrO2 = 0 GoTo rr7 End If MZrO2 = DatiOrigine(i, nZrO2) If MZrO2 < 0 Then MZrO2 = 0 End If rr7: MSiO2 = DatiOrigine(i, nSiO2) If MSiO2 < 0 Then MSiO2 = 0 End If MTiO2 = DatiOrigine(i, nTiO2) If MTiO2 < 0 Then MTiO2 = 0 End If MK2O = DatiOrigine(i, nK2O) If MK2O < 0 Then MK2O = 0 End If MAl2O3 = DatiOrigine(i, nAl2O3) If MAl2O3 < 0 Then MAl2O3 = 0 End If MNa2O = DatiOrigine(i, nNa2O) If MNa2O < 0 Then MNa2O = 0 End If MFe2O3 = DatiOrigine(i, nFe2O3) If MFe2O3 < 0 Then MFe2O3 = 0 End If MMgO = DatiOrigine(i, nMgO) If MMgO < 0 Then MMgO = 0 End If SumOxide = MFeO + MMnO + ((MNiO / 10000) * 1.273) + MCaO + ((MBaO / 10000) * 1.117) + ((MSrO / 10000) * 1.183) + MP2O5 + MS + ((MCr2O3 / 10000) * 1.462) + MCO2 + ((MZrO2 / 10000) * 1.351) + MSiO2 + MTiO2 + MK2O + MAl2O3 + MNa2O + MFe2O3 + MMgO MFeO = MFeO / WFeO MMnO = MMnO / WMnO MNiO = (MNiO / 10000) * 1.273 / WNiO MCaO = MCaO / WCaO MBaO = (MBaO / 10000) * 1.117 / WBaO MSrO = (MSrO / 10000) * 1.183 / WSrO MP2O5 = MP2O5 / WP2O5 MS = MS / WS MCr2O3 = (MCr2O3 / 10000) * 1.462 / WCr2O3 MCO2 = MCO2 / WCO2 MZrO2 = (MZrO2 / 10000) * 1.351 / WZrO2 MSiO2 = MSiO2 / WSiO2 MTiO2 = MTiO2 / WTiO2 MK2O = MK2O / WK2O MAl2O3 = MAl2O3 / WAl2O3 MNa2O = MNa2O / WNa2O MFe2O3 = MFe2O3 / WFe2O3 MMgO = MMgO / WMgO Sumoxide1 = MFeO + MMnO + MNiO + MCaO + MBaO + MSrO + MP2O5 + MS + MCr2O3 + MCO2 + MZrO2 + MSiO2 + MTiO2 + MK2O + MAl2O3 + MNa2O + MFe2O3 + MMgO ' MFeO = MFeO + MMnO + MNiO MCaO = MCaO + MBaO + MSrO '1 Apatite = MP2O5 ' il file excel è / 1.5 MCaO = MCaO - ((3.33) * MP2O5) MP2O5 = 0 '2 Pyrite = MS MFeO = MFeO - (MS / 2) MS = 0 '3 Chromite = MCr2O3 MFeO = MFeO - MCr2O3 MCr2O3 = 0 '5 Fluorite = MF MCaO = MCaO - 0.5 * MF MF = 0 '6 Calcite = MCO2 MCaO = MCaO - MCO2 MCO2 = 0 '7 Zircon = MZrO2 MSiO2 = MSiO2 - MZrO2 MZrO2 = 0 '4a If MFeO >= MTiO2 Then Ilmenite = MTiO2 MFeO = MFeO - MTiO2 MTiO2 = 0 GoTo poig: End If If MTiO2 > MFeO Then Ilmenite = MFeO MTiO2 = MTiO2 - MFeO MFeO = 0 End If poig: '8 If MK2O <= MAl2O3 Then P_Orthoclase = MK2O MAl2O3 = MAl2O3 - MK2O MSiO2 = MSiO2 - (6 * MK2O) MK2O = 0 Else P_Orthoclase = MAl2O3 MSiO2 = MSiO2 - (6 * MAl2O3) K_meta = MK2O - MAl2O3 MSiO2 = MSiO2 - K_meta MAl2O3 = 0 End If If MAl2O3 >= MNa2O Then P_Albite = MNa2O MAl2O3 = MAl2O3 - MNa2O MSiO2 = MSiO2 - (6 * MNa2O) MNa2O = 0 End If If MNa2O > MAl2O3 Then P_Albite = MAl2O3 MNa2O = MNa2O - MAl2O3 MSiO2 = MSiO2 - (6 * MAl2O3) MAl2O3 = 0 If MNa2O >= MFe2O3 Then Acmite = MFe2O3 MNa2O = MNa2O - MFe2O3 MSiO2 = MSiO2 - (4 * MFe2O3) MFe2O3 = 0 Else Acmite = MNa2O MFe2O3 = MFe2O3 - MNa2O MSiO2 = MSiO2 - (4 * MNa2O) MNa2O = 0 End If End If If MNa2O > 0 Then Na2SiO3 = MNa2O MSiO2 = MSiO2 - MNa2O MNa2O = 0 End If If MAl2O3 > 0 Then If MAl2O3 > MCaO Then Anorthite = MCaO MSiO2 = MSiO2 - (2 * MCaO) MAl2O3 = MAl2O3 - MCaO MCaO = 0 Else Anorthite = MAl2O3 MSiO2 = MSiO2 - (2 * MAl2O3) MCaO = MCaO - MAl2O3 MAl2O3 = 0 End If End If If MTiO2 > 0 Then If MTiO2 >= MCaO Then P_sphene = MCaO MTiO2 = MTiO2 - MCaO MSiO2 = MSiO2 - MCaO MCaO = 0 Else P_sphene = MTiO2 MCaO = MCaO - MTiO2 MSiO2 = MSiO2 - MTiO2 MTiO2 = 0 End If End If If MTiO2 > 0 Then Rutile = MTiO2 End If If MAl2O3 > 0 Then Corundum = MAl2O3 End If If MFeO >= MFe2O3 Then Magnetite = MFe2O3 MFeO = MFeO - MFe2O3 MFe2O3 = 0 GoTo poit End If If MFe2O3 > MFeO Then Magnetite = MFeO MFe2O3 = MFe2O3 - MFeO MFeO = 0 Hematite = MFe2O3 MFe2O3 = 0 End If poit: summf = MFeO + MMgO If summf = 0 Then GoTo piy FeOprop = MFeO / (MFeO + MMgO) MgOprop = MMgO / (MFeO + MMgO) If summf > MCaO Then P_Diopside = MCaO summf = summf - MCaO MSiO2 = MSiO2 - (2 * MCaO) P_Hypersthene = summf MSiO2 = MSiO2 - (summf) MCaO = 0 summf = 0 Else P_Diopside = summf MCaO = MCaO - summf MSiO2 = MSiO2 - (2 * summf) P_Wollastonite = MCaO MSiO2 = MSiO2 - (MCaO) MCaO = 0 summf = 0 End If piy: If MSiO2 > 0 Then Quartz = MSiO2 MSiO2 = 0 GoTo finenorm End If da = -MSiO2 If da < (P_Hypersthene / 2) Then Olivine = da Hypersthene = P_Hypersthene - (2 * da) P_Hypersthene = 0 da = 0 GoTo finenorm End If If da >= (P_Hypersthene / 2) Then Olivine = P_Hypersthene / 2 da = da - (P_Hypersthene / 2) P_Hypersthene = 0 Hypersthene = 0 End If If P_sphene = 0 Then GoTo poier End If If da < P_sphene Then Perovskite = da Sphene = P_sphene - da da = 0 GoTo finenorm End If If da > P_sphene Then Perovskite = P_sphene da = da - P_sphene Sphene = 0 End If poier: If da < (4 * P_Albite) Then Nepheline = (da / 4) Albite = P_Albite - (da / 4) P_Albite = 0 da = 0 GoTo finenorm End If If da >= (4 * P_Albite) Then Nepheline = P_Albite da = da - (4 * P_Albite) P_Albite = 0 Albite = 0 End If If da < (2 * P_Orthoclase) Then Leucite = da / 2 Orthoclase = P_Orthoclase - (da / 2) P_Orthoclase = 0 da = 0 GoTo finenorm End If If da >= (2 * P_Orthoclase) Then Leucite = P_Orthoclase da = da - (2 * P_Orthoclase) P_Orthoclase = 0 Orthoclase = 0 End If If P_Wollastonite = 0 Then GoTo wrt End If If da < (P_Wollastonite / 2) Then Calcium_Orthosilicate = da Wollastonite = P_Wollastonite - (2 * da) P_Wollastonite = 0 da = 0 GoTo finenorm End If If da > (P_Wollastonite / 2) Then Calcium_Orthosilicate = P_Wollastonite / 2 da = da - P_Wollastonite / 2 Wollastonite = 0 P_Wollastonite = 0 End If wrt: If da < P_Diopside Then Calcium_Orthosilicate = Calcium_Orthosilicate + (da / 2) Olivine = Olivine + (da / 2) Diopside = P_Diopside - da P_Diopside = 0 da = 0 GoTo finenorm End If If da > P_Diopside Then Calcium_Orthosilicate = Calcium_Orthosilicate + (P_Diopside / 2) Olivine = Olivine + (P_Diopside / 2) da = da - P_Diopside Diopside = 0 P_Diopside = 0 End If If da > 0 Then Kaliophilite = da / 2 Leucite = Leucite - da / 2 da = 0 GoTo finenorm End If finenorm: If Wollastonite = 0 And P_Wollastonite <> 0 Then Wollastonite = P_Wollastonite End If If Apatite = 0 And P_Apatite <> 0 Then Apatite = P_Apatite End If If Pyrite = 0 And P_Pyrite <> 0 Then Pyrite = P_Pyrite End If If Chromite = 0 And P_Chromite <> O Then Chromite = P_Chromite End If If Fluorite = 0 And P_Fluorite <> 0 Then Fluorite = P_Fluorite End If If Calcite = 0 And P_Calcite <> 0 Then Calcite = P_Calcite End If If Zircon = 0 And P_Zircon <> 0 Then Zircon = P_Zircon End If If Ilmenite = 0 And P_Ilmenite <> 0 Then Ilmenite = P_Ilmenite End If If Sphene = 0 And P_sphene <> 0 Then Sphene = P_sphene End If If Orthoclase = 0 And P_Orthoclase <> 0 Then Orthoclase = P_Orthoclase End If If Albite = 0 And P_Albite <> O Then Albite = P_Albite End If If Aegerine = 0 And P_Aegerine <> 0 Then Aegerine = P_Aegerine End If If Anorthite = 0 And Anorthite <> 0 Then Anorthite = P_Anorthite End If If Corundum = 0 And P_Corundum <> 0 Then Corundum = P_Corundum End If If Magnetite = 0 And P_Magnetite <> 0 Then Magnetite = P_Magnetite End If If Hematite = 0 And P_Hematite <> 0 Then Hematite = P_Hematite End If If Diopside = 0 And P_Diopside <> 0 Then Diopside = P_Diopside End If If Hypersthene = 0 And P_Hypersthene <> 0 Then Hypersthene = P_Hypersthene End If If Quartz = 0 And P_Quartz <> 0 Then Quartz = P_Quartz End If If Olivine = 0 And P_Olivine <> 0 Then Olivine = P_Olivine End If If Perovskite = 0 And P_Perovskite <> 0 Then Perovskite = P_Perovskite End If If Rutile = 0 And P_Rutile <> 0 Then Rutile = P_Rutile End If If Nepheline = 0 And P_Nepheline <> 0 Then Nepheline = P_Nepheline End If If Leucite = 0 And P_Leucite <> 0 Then Leucite = P_Leucite End If If Calcium_Orthosilicate = 0 And P_Calcium_Orthosilicate <> 0 Then Calcium_Orthosilicate = P_Calcium_Orthosilicate End If If Kaliophilite = 0 And P_Kaliophilite <> 0 Then Kaliophilite = P_Kaliophilite End If If Na2SiO3 = 0 And P_Na2SiO3 <> 0 Then Na2SiO3 = P_Na2SiO3 End If Apatite = Apatite * 336.21 'ok Pyrite = Pyrite * 135.9664 '??????? Chromite = Chromite * 223.8366 'ok Fluorite = Fluorite * 94.0762 '??????? Calcite = Calcite * 100.0892 'ok Zircon = Zircon * 183.3031 'ok Ilmenite = Ilmenite * 151.7452 'ok Sphene = Sphene * 196.0625 'ok Orthoclase = Orthoclase * 556.6631 'ok Albite = Albite * 524.446 'ok Aegerine = Aegerine '?????????????? Anorthite = Anorthite * 278.2093 'ok Corundum = Corundum * 101.9613 'ok Magnetite = Magnetite * 231.5386 'ok Hematite = Hematite * 159.6922 'ok Diopside = FeOprop * Diopside * 248.09 + MgOprop * Diopside * 216.55 Hypersthene = FeOprop * Hypersthene * 131.93 + MgOprop * Hypersthene * 100.39 Wollastonite = Wollastonite * 116.1637 'ok Quartz = Quartz * 60.0843 'ok Olivine = FeOprop * Olivine * 203.78 + MgOprop * Olivine * 140.7 'ok Perovskite = Perovskite * 135.9782 'ok Rutile = Rutile * 79.8988 'ok Nepheline = Nepheline * 284.1088 'ok Leucite = Leucite * 436.4945 'o9k Calcium_Orthosilicate = Calcium_Orthosilicate * 172.24 '86.12 ' Kaliophilite = Kaliophilite * 316.32 'ok Na2SiO3 = Na2SiO3 * 122.0632 'ok K_meta = K_meta * 154.3 Acmite = Acmite * 462 'inserisco i dati nel form7 Sumphase = Apatite + Pyrite + Chromite + Fluorite + Calcite + Zircon + Ilmenite + Sphene + Orthoclase + Albite + Aegerine + Anorthite + Corundum + Magnetite + Hematite + Diopside + Hypersthene + Wollastonite + Quartz + Olivine + Perovskite + Rutile + Nepheline + Leucite + Calcium_Orthosilicate + Kaliophilite + Na2SiO3 + K_meta + Acmite Sumphase = Format(Sumphase, "0.0") SumOxide = Format(SumOxide, "0.0") DiffOxPh = SumOxide - Sumphase Form7.Fl2.Row = i Form7.Fl2.col = 1 Form7.Fl2.Text = Format$(Apatite, "0.00") DatiCIPW(i, 1) = Format$(Apatite, "0.00") Form7.Fl2.col = 2 Form7.Fl2.Text = Format$(Pyrite, "0.00") DatiCIPW(i, 2) = Format$(Pyrite, "0.00") Form7.Fl2.col = 3 Form7.Fl2.Text = Format$(Chromite, "0.00") DatiCIPW(i, 3) = Format$(Chromite, "0.00") Form7.Fl2.col = 4 Form7.Fl2.Text = Format$(Fluorite, "0.00") DatiCIPW(i, 4) = Format$(Fluorite, "0.00") Form7.Fl2.col = 5 Form7.Fl2.Text = Format$(Calcite, "0.00") DatiCIPW(i, 5) = Format$(Calcite, "0.00") Form7.Fl2.col = 6 Form7.Fl2.Text = Format$(Zircon, "0.00") DatiCIPW(i, 6) = Format$(Zircon, "0.00") Form7.Fl2.col = 7 Form7.Fl2.Text = Format$(Ilmenite, "0.00") DatiCIPW(i, 7) = Format$(Ilmenite, "0.00") Form7.Fl2.col = 8 Form7.Fl2.Text = Format$(Sphene, "0.00") DatiCIPW(i, 8) = Format$(Sphene, "0.00") Form7.Fl2.col = 9 Form7.Fl2.Text = Format$(Orthoclase, "0.00") DatiCIPW(i, 9) = Format$(Orthoclase, "0.00") Form7.Fl2.col = 10 Form7.Fl2.Text = Format$(Albite, "0.00") DatiCIPW(i, 10) = Format$(Albite, "0.00") Form7.Fl2.col = 11 Form7.Fl2.Text = Format$(Aegerine, "0.00") DatiCIPW(i, 11) = Format$(Aegerine, "0.00") Form7.Fl2.col = 12 Form7.Fl2.Text = Format$(Anorthite, "0.00") DatiCIPW(i, 12) = Format$(Anorthite, "0.00") Form7.Fl2.col = 13 Form7.Fl2.Text = Format$(Corundum, "0.00") DatiCIPW(i, 13) = Format$(Corundum, "0.00") Form7.Fl2.col = 14 Form7.Fl2.Text = Format$(Magnetite, "0.00") DatiCIPW(i, 14) = Format$(Magnetite, "0.00") Form7.Fl2.col = 15 Form7.Fl2.Text = Format$(Hematite, "0.00") DatiCIPW(i, 15) = Format$(Hematite, "0.00") Form7.Fl2.col = 16 Form7.Fl2.Text = Format$(Diopside, "0.00") DatiCIPW(i, 16) = Format$(Diopside, "0.00") Form7.Fl2.col = 17 Form7.Fl2.Text = Format$(Hypersthene, "0.00") DatiCIPW(i, 17) = Format$(Hypersthene, "0.00") Form7.Fl2.col = 18 Form7.Fl2.Text = Format$(Wollastonite, "0.00") DatiCIPW(i, 18) = Format$(Wollastonite, "0.00") Form7.Fl2.col = 19 Form7.Fl2.Text = Format$(Quartz, "0.00") DatiCIPW(i, 19) = Format$(Quartz, "0.00") Form7.Fl2.col = 20 Form7.Fl2.Text = Format$(Olivine, "0.00") DatiCIPW(i, 20) = Format$(Olivine, "0.00") Form7.Fl2.col = 21 Form7.Fl2.Text = Format$(Perovskite, "0.00") DatiCIPW(i, 21) = Format$(Perovskite, "0.00") Form7.Fl2.col = 22 Form7.Fl2.Text = Format$(Rutile, "0.00") DatiCIPW(i, 22) = Format$(Rutile, "0.00") Form7.Fl2.col = 23 Form7.Fl2.Text = Format$(Nepheline, "0.00") DatiCIPW(i, 23) = Format$(Nepheline, "0.00") Form7.Fl2.col = 24 Form7.Fl2.Text = Format$(Leucite, "0.00") DatiCIPW(i, 24) = Format$(Leucite, "0.00") Form7.Fl2.col = 25 Form7.Fl2.Text = Format$(Calcium_Orthosilicate, "0.00") DatiCIPW(i, 25) = Format$(Calcium_Orthosilicate, "0.00") Form7.Fl2.col = 26 Form7.Fl2.Text = Format$(Kaliophilite, "0.00") DatiCIPW(i, 26) = Format$(Kaliophilite, "0.00") Form7.Fl2.col = 27 Form7.Fl2.Text = Format$(Na2SiO3, "0.00") DatiCIPW(i, 27) = Format$(Na2SiO3, "0.00") Form7.Fl2.col = 28 Form7.Fl2.Text = Format$(K_meta, "0.00") DatiCIPW(i, 28) = Format$(K_meta, "0.00") Form7.Fl2.col = 29 Form7.Fl2.Text = Format$(Acmite, "0.00") DatiCIPW(i, 29) = Format$(Acmite, "0.00") Form7.Fl2.col = 30 Form7.Fl2.Text = Format$(SumOxide, "0.0") DatiCIPW(i, 30) = Format$(SumOxide, "0.0") Form7.Fl2.col = 31 Form7.Fl2.Text = Format$(Sumphase, "0.0") DatiCIPW(i, 31) = Format$(Sumphase, "0.0") Form7.Fl2.col = 32 Form7.Fl2.Text = Format$(DiffOxPh, "0.0") DatiCIPW(i, 32) = Format$(DiffOxPh, "0.0") Next i For i = 1 To Numcamp1 Form7.Fl2.col = 0 Form7.Fl2.Row = i Form7.Fl2.Text = NomeCamp(i) Next i GoTo errorfalse errorTrue: MsgBox "An Error Occurred: I'm not able to identify all necessary species for CIPW" errorfalse: GoTo rety1 rety: MsgBox "An Error Occurred: CIPW failed", , "Attention" rety1: End Sub