• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

'CountNoStrike' Formula Question

G@ines63

New Member
Hello,
I am updating an existing excel workbook and I have a question regarding strikethroughs.
With assistance, I was able to write a VBA code and a formula for counting all cells in a range that do not have strikethroughs, but I need help on a code and/or formula that will recalculate the cells if strikethroughs are used.
Thank you in advance.

G@ines63
 
Hi ,

Not very clear.

What is your code and formula ? Is it returning the number of cells which do not have strikethroughs ?

What do you want now ? Is it the number of strikethroughs ? If so , would this not be the total number of cells in the range less the number of cells which do not have strikethroughs ?

Narayan
 
Narayan, thank you for your response.

I was able to create a VBA code and formula to count all cells in a range without strikethroughs....

VBA Code that I used:

Public Function CountNoStrike(pWorkRng As Range) As Long
'Update 20140819
Application.Volatile
Dim pRng As Range
Dim xOut As Long
xOut = 0
For Each pRng In pWorkRng
If Not pRng.Font.Strikethrough Then
xOut = xOut + 1
End If
Next
CountNoStrike = xOut
End Function


Formula that I used in the attached example: =CountNoStrike(D4:D9)
 

Attachments

  • Copy of tracker.xlsx
    178.1 KB · Views: 7
Back
Top