Dear all,
i like to know how to count correctly for 4 questions in C43 to C46. Which formula (or) VBA code will answer and which one should i use in "yellow color" filled cells in column D and G in attached image.
I tested and used the followings module 1 to 4 as below in attached image file. But, i cannot correctly count which i needed.
Thanks in advance for your expertise and knowledge sharing.
Module 1: Count NO strikethorugh text
Function CountNoStrikeThrough(r As Range) As Long
Application.Volatile
Dim c As Range, d As Long
For Each c In r
If c <> "" Then
If c.Font.Strikethrough = False Then d = d + 1
End If
Next c
CountNoStrikeThrough = d
End Function
Module 2: Count strikethrough cells (My notes: it is not working correctly if cells are merged)
Public Function CountStrike(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 pRng.Font.Strikethrough Then
xOut = xOut + 1
End If
Next
CountStrike = xOut
End Function
Module 3: Count Without Strikethrough Cells (My notes: it is not working correctly if cells are merged)
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
Module 4: Sum exclude strikethrough cells (My notes: it is only work with "numbers")
Public Function ExcStrike(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 + pRng.Value
End If
Next
ExcStrike = xOut
End Function
i like to know how to count correctly for 4 questions in C43 to C46. Which formula (or) VBA code will answer and which one should i use in "yellow color" filled cells in column D and G in attached image.
I tested and used the followings module 1 to 4 as below in attached image file. But, i cannot correctly count which i needed.
Thanks in advance for your expertise and knowledge sharing.
Module 1: Count NO strikethorugh text
Function CountNoStrikeThrough(r As Range) As Long
Application.Volatile
Dim c As Range, d As Long
For Each c In r
If c <> "" Then
If c.Font.Strikethrough = False Then d = d + 1
End If
Next c
CountNoStrikeThrough = d
End Function
Module 2: Count strikethrough cells (My notes: it is not working correctly if cells are merged)
Public Function CountStrike(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 pRng.Font.Strikethrough Then
xOut = xOut + 1
End If
Next
CountStrike = xOut
End Function
Module 3: Count Without Strikethrough Cells (My notes: it is not working correctly if cells are merged)
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
Module 4: Sum exclude strikethrough cells (My notes: it is only work with "numbers")
Public Function ExcStrike(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 + pRng.Value
End If
Next
ExcStrike = xOut
End Function