Anda di halaman 1dari 2

Sub ANTOPUESTO_Ex6()

Dim x As Integer

'Dim determines the variable's data type and variable name


'We set x as the variable for row number

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"

'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 this condition is true, then the given geochemical data is of


dacite.

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 this condition is true, then the given geochemical data is of


basaltic andesite.
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 this condition is true, then the given geochemical data is of


rhyolite

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 this condition is true, then the given geochemical data is of


rhyo-dacite.

Else
Cells(x, 24).Value = "unknown"

'If all the conditions above are false, the rock will be unknown.

End If

'End of the conditional statement

Range("X5:X111").Font.Color = rgbCadetBlue
Range("X5:X111").Interior.Color = rgbLightGrey

'Range is used to refer to a cell, a row or column of cells then


follows the condition.
Next x

'this terminates the definition of the for loop

End Sub

Anda mungkin juga menyukai