itipu
03-16-2007, 05:21 AM
Can't seem to figure out why this little code I wrote does not work...
Basically it should look through each cell in given range, and count all cells that contain "-d"
Sub CountRE()
Dim count As Integer
Dim cel As Range
Dim rng As Range
Set rng = Sheet6.Range("A1:A20")
count = 0
For Each cel In rng
If TypeName(cel.Value) = "*-d*" Then
count = count + 1
End If
Next
frmExtract.TextBox1.Value = count
End Sub
Thanks a lot
Mike
Basically it should look through each cell in given range, and count all cells that contain "-d"
Sub CountRE()
Dim count As Integer
Dim cel As Range
Dim rng As Range
Set rng = Sheet6.Range("A1:A20")
count = 0
For Each cel In rng
If TypeName(cel.Value) = "*-d*" Then
count = count + 1
End If
Next
frmExtract.TextBox1.Value = count
End Sub
Thanks a lot
Mike