I thought this should be pretty simple. I basically just want a count of how
many meet a certain criteria in a column. But I am getting really weird
results!
I wrote the following code to pick up only information if there was an FO or
FR in column 22 and if column 5 had a range of 0-150, if all this critereia
is met I want it to go to column 17 and count how many in this column show a
number greater than 1. The next if statement says if colum 18 has a number >1
count how many, the same for column 19, again another if statement. The next
two if statements say if there is an X in column 12 count how many - this
one is not working at all. I want the next if statement to count any cells
that are not blank. The next if doesn't work either, I am trying to get it
to pick up anything that isn't blank in the column, there could be numerous
letters so I thought that would be the easist way.
Do I have to many if statements? The first three are doubling the numbers or
worse. I am getting bigger numbers every time I run it. What am I doing
wrong?
Dim 150DEL30, 150Del60, 150DelNA, 150CO As Long
For Each cell In Range("NoteList")
If cell.Offset(0, 22) = "FO" Or cell.Offset(0, 22) = "FR" Then
If cell.Offset(0, 5) > "00" And cell.Offset(0, 5) < "150" Then
Select Case cell.Offset(0, 2)
Case 600 To 606
If cell.Offset(0, 17) >= 1 Then
150DEL30 = 150DEL30 + 1
End If
If cell.Offset(0, 18) >= 1 Then
150DEL60 = 150DEL60 + 1
End If
If cell.Offset(0, 19) >= 1 Then
150DEL90 = 150DEL90 + 1
End If
If cell.Offset(0, 12) = "X" Then
150NA = 150NA + 1
End If
If cell.Offset(0, 23) <> " " Then
150CO = 150CO + 1
End If
End Select
Next Cell
Bookmarks