Sub Auto_Open()
Application.ScreenUpdating = False
Dim count4u As Long
Dim count4g As Long
...
Dim i As Double
i = 4
count4u = 0
count4g = 0
count4t = 0
...
Sheets("data").Select
Do While Cells(i, 3).Value <> ""
Cells(i, 3).Activate
If Left(ActiveCell.Value, 3) = "CP1" Then
If Mid(ActiveCell.Value, 4, 1) = "U" Then
count4u = count4u + 1
ElseIf Mid(ActiveCell.Value, 4, 1) = "G" Then
count4g = count4g + 1
ElseIf Mid(ActiveCell.Value, 4, 1) = "T" Then
count4t = count4t + 1
ElseIf Mid(ActiveCell.Value, 4, 1) = "B" Then
count4b = count4b + 1
ElseIf Mid(ActiveCell.Value, 4, 1) = "F" Then
count4f = count4f + 1
ElseIf Mid(ActiveCell.Value, 4, 1) = "C" Then
count4c = count4c + 1
End If
...
i = i + 1
Loop
Worksheets("Base").Activate
Range("X6") = count4u
...
Call cp2count
End Sub
I have tried a couple of different solutions, one trying to use a for each loop and Range("C4", Range("C4").End(xldown)).SpecialCells(xlCellTypeVisible). The other time i just tried selecting the cells with specialcells(xlcelltypevisible) and loop through it the way I have it. I am having a problem being able to count the character in the 4th/5th position without using the activecell function.