I am trying to write a vba script that counts commas that are visible then adds them to a previously defined variable.
Here's what I have been able to come up with so far, however I know that it won't work because none of the cells have just a comma in them....I am trying to attempt to actually add one to the "counter" variable for every comma that is found within the cell of column "O" or column 15.
Dim rng As Range
Set rng = ActiveSheet.AutoFilter.Range
counter = 0
Last = Cells(Rows.Count, "O").End(xlUp).Row
For i = Last To 1 Step -1
If (Cells(i, "O").Value) = "," And Rows(i).EntireRow.Hidden = False_ Then
counter = counter + 1
End If
Next i
MsgBox counter
Here's what I have been able to come up with so far, however I know that it won't work because none of the cells have just a comma in them....I am trying to attempt to actually add one to the "counter" variable for every comma that is found within the cell of column "O" or column 15.
Dim rng As Range
Set rng = ActiveSheet.AutoFilter.Range
counter = 0
Last = Cells(Rows.Count, "O").End(xlUp).Row
For i = Last To 1 Step -1
If (Cells(i, "O").Value) = "," And Rows(i).EntireRow.Hidden = False_ Then
counter = counter + 1
End If
Next i
MsgBox counter