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) <= 1 Or Cells(x, 10) >=
1.1 Or Cells(x, 15) >= 1.9 And Cells(x, 15) <= 1.99 Then
Cells(x, 24).Value = "Basalt"
If Cells(x, 24).Value = "Basalt" Then Cells(x, 24).Interior.Color =
rgbBeige 'this will set the color to Beige
'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"
If Cells(x, 24).Value = "Andesite" Then Cells(x, 24).Interior.Color
= rgbAquamarine 'this will set the interior color to Aquamarine
'If this condition is true, then the given geochemical data is of 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"
If Cells(x, 24).Value = "Dacite" Then Cells(x, 24).Interior.Color =
rgbBlanchedAlmond 'this will set the interior color to BlanchedAlmond
'If this condition is true, then the given geochemical data is of dacite.
ElseIf Cells(x, 2).Value >= 71.5 Or Cells(x, 3).Value >= 0 And Cells(x,
3).Value <= 14.8 Or Cells(x, 4).Value >= 0 And Cells(x, 4).Value <= 5 Or Cells(x,
5).Value >= 0 And Cells(x, 5).Value <= 3.4 Or Cells(x, 6).Value >= 0 And Cells(x,
6).Value <= 0.8 Or Cells(x, 7).Value >= 3.4 And Cells(x, 7).Value <= 3.5 Or
Cells(x, 8).Value >= 4.1 Or Cells(x, 10).Value >= 0# And Cells(x, 10).Value <= 0.49
Or Cells(x, 15).Value >= 1.4 And Cells(x, 15) <= 1.5 Then
Cells(x, 24).Value = "Rhyolite"
If Cells(x, 24).Value = "Rhyolite" Then Cells(x, 24).Interior.Color
= rgbAliceBlue 'this will set the interior color to AliceBlue
'If this condition is true, then the given geochemical data is of rhyolite
ElseIf Cells(x, 2).Value >= 54.3 And Cells(x, 2).Value <= 60 Or Cells(x,
3).Value >= 15.7 And Cells(x, 3).Value <= 16 Or Cells(x, 4).Value >= 9.2 And
Cells(x, 4).Value <= 10.3 Or Cells(x, 5).Value >= 8.1 And Cells(x, 5).Value <= 9.9
Or Cells(x, 6).Value >= 3.7 And Cells(x, 6) >= 7.3 Or Cells(x, 7).Value >= 3.2 And
Cells(x, 7).Value <= 3.3 Or Cells(x, 8).Value >= 2.1 And Cells(x, 8).Value <= 2.4
Or Cells(x, 10).Value >= 0.8 And Cells(x, 10).Value <= 1# Or Cells(x, 15).Value >=
2# Then
Cells(x, 24).Value = "Basaltic andesite"
If Cells(x, 24).Value = "Basaltic andesite" Then Cells(x,
24).Interior.Color = rgbBisque 'this will set the interior color to Bisque
'If this condition is true, then the given geochemical data is of basaltic
andesite.
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"
If Cells(x, 24).Value = "Rhyo-Dacite" Then Cells(x,
24).Interior.Color = rgbChartreuse 'this will set the interior color to Chartreuse
'If this condition is true, then the given geochemical data is of rhyo-dacite.
Else
Cells(x, 24).Value = "unknown"
If Cells(x, 24).Value = "unknown" Then Cells(x, 24).Interior.Color =
rgbCrimson 'this will set the interior color to Crimson
'If all the conditions above are false, the rock will be unknown.
End If
Next x
End Sub