Dim x As Integer
For x = 5 To 111
'We limit the value of x from 5 to 111 as the given geochemical data starts in row
5 and ends in row 111. This starts the loop from x=5 up to x=111
If Cells(x, 2).Value >= 0.1 And Cells(x, 2).Value <= 54.2 Or Cells(x,
3).Value >= 14.9 And Cells(x, 3).Value <= 15.2 Or Cells(x, 4).Value >= 10.4 Or
Cells(x, 5).Value >= 10 Or Cells(x, 6).Value >= 7.4 Or Cells(x, 7).Value >= 0.1 And
Cells(x, 7).Value <= 2.6 Or Cells(x, 8).Value >= 0.1 And Cells(x, 8).Value <= 1 Or
Cells(x, 10).Value >= 1.1 Or Cells(x, 15).Value >= 1.9 And Cells(x, 15).Value <=
1.99 Then
Cells(x, 24).Value = "Basalt"
'If the first condition is true, then the given geochemical data is
of basalt. If false, move on to the conditions below.
ElseIf Cells(x, 2).Value >= 60.1 And Cells(x, 2).Value <= 64.8 Or
Cells(x, 3).Value >= 16.1 And Cells(x, 3).Value <= 16.3 Or Cells(x, 4).Value >= 6.9
And Cells(x, 4).Value <= 9.1 Or Cells(x, 5).Value >= 5.9 And Cells(x, 5).Value <=
8.1 Or Cells(x, 6).Value >= 2.8 And Cells(x, 6).Value <= 3.6 Or Cells(x, 7).Value
>= 3.8 And Cells(x, 7).Value <= 3.89 Or Cells(x, 8).Value >= 2.1 And Cells(x,
8).Value <= 2.4 Or Cells(x, 10).Value >= 0.7 And Cells(x, 10).Value <= 0.79 Or
Cells(x, 15).Value >= 1.8 And Cells(x, 15).Value <= 1.89 Then
Cells(x, 24).Value = "Andesite"
ElseIf Cells(x, 2).Value >= 64.8 And Cells(x, 2).Value <= 66.1 Or
Cells(x, 3).Value >= 16.4 Or Cells(x, 4).Value >= 5.1 And Cells(x, 4).Value <= 6.8
Or Cells(x, 5).Value >= 3.6 And Cells(x, 5).Value <= 5.8 Or Cells(x, 6).Value >=
1.7 And Cells(x, 6).Value <= 2.7 Or Cells(x, 7).Value >= 3.6 And Cells(x, 7).Value
<= 3.7 Or Cells(x, 8).Value >= 2.5 And Cells(x, 8).Value <= 3# Or Cells(x,
10).Value >= 0.6 And Cells(x, 10).Value <= 0.69 Or Cells(x, 15).Value >= 1.6 And
Cells(x, 15).Value <= 1.7 Then
Cells(x, 24).Value = "Dacite"
ElseIf Cells(x, 2).Value >= 66.2 And Cells(x, 2).Value <= 71.4 Or
Cells(x, 3).Value >= 15.3 And Cells(x, 3).Value <= 15.6 Or Cells(x, 4).Value >= 5.1
And Cells(x, 4).Value <= 6.8 Or Cells(x, 5).Value >= 3.5 And Cells(x, 5).Value <=
3.59 Or Cells(x, 6).Value >= 0.9 And Cells(x, 6).Value <= 1.6 Or Cells(x, 7).Value
>= 3.9 Or Cells(x, 8).Value >= 3.1 And Cells(x, 8).Value <= 4# Or Cells(x,
10).Value >= 0.49 And Cells(x, 10).Value <= 0.59 Or Cells(x, 15).Value >= 0.1 And
Cells(x, 15).Value <= 1.3 Then
Cells(x, 24).Value = "Rhyo-Dacite"
Else
Cells(x, 24).Value = "unknown"
'If all the conditions above are false, the rock will be unknown.
End If
Range("X5:X111").Font.Color = rgbCadetBlue
Range("X5:X111").Interior.Color = rgbLightGrey
End Sub