I need to count the number of letter "B" in a cell when "CS55" and "B" are present
the way I am counting the letter is:
length of the string - length of the string without any letter B = the number of letter B
code below, error message pops up every time I run it "Type mismatch"
the format of these cells are very consistent: Paint,CS55,B/G/R, Paint,CS55,B/G, Paint,CS55,B/W, Paint,CS55,R/B/G....etc
any help is appreciated !
the way I am counting the letter is:
length of the string - length of the string without any letter B = the number of letter B
code below, error message pops up every time I run it "Type mismatch"
VBA Code:
Dim lrNew As Long, n As Long
lrNew = Range("A" & Rows.Count).End9xlUp).Row
If Cells(lrNew, "K").Value Like "*CS55*" Then
n = ws1.Evaluate("LEN)(" & Cells(lrNew, 11).Address & "-LEN(SUBSTITUTE(" & Cells(lrNew, 11).Address & ",""B"","""")")
End If
the format of these cells are very consistent: Paint,CS55,B/G/R, Paint,CS55,B/G, Paint,CS55,B/W, Paint,CS55,R/B/G....etc
any help is appreciated !