Hey, hope someone can give me some useful advice...basically what i am trying to do is look at each cell in a column (or range), then increase the appropriate counter depending on which range the value falls within.here is my code thus far...
any help appreciated!!
tan :-)
Sub test()
Dim count1 As Integer
Dim count2 As Integer
Dim count3 As Integer
Dim i As Integer
Dim x As Integer
x = 0
count1 = 0
count2 = 0
count3 = 0
For Counter = 1 To 6 ' this is how many samples in 8 hrs
'Set curCell = Worksheets("rad_10secs_5days").Cells(x, 9).Value
'Worksheets("rad_10secs_5days")
If Cells(x, 9).Value < 86 Then 'if less than 86%
count1 = count1 + 1
ElseIf Cells(x, 9).Value >= 86 And Cells(x, 9).Value < 95 Then
count2 = count2 + 1 'if between 86-94% inclusive
Else ' if greater than 94%
count3 = count3 + 1
End If
x = x + 1
Next Counter
MsgBox "Saturation < 86% is " & count1 & vbCrLf & "Saturation 86-94 is " & count2 & vbCrLf & "Saturation > 94% is " & count3
'Worksheets("Sheet2").Range ("A1:B5")-how to define range in worksheet
End Sub
Bookmarks