Okay, not sure if this is a good way to go about it, but I modified to this. The Sub Tasks can also be actually task that do not start with Sub.
Sub FilterUnique()
Dim rng As Range, Dn As Range
With Sheet22
.Columns(7).Clear
Set rng = .Range(.Range("C8"), .Range("C" & .Rows.Count).End(xlUp))
End With
Debug.Print rng.Address
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
For Each Dn In rng
If Not .Exists(Dn.Value) And Dn.Offset(, 1).Value = "Major Task" Then
.Add Dn.Value, ""
End If
Next
Sheet22.Range("G8").Resize(.Count).Value = Application.Transpose(.keys)
End With
Call CountTask
End Sub
Sub CountTask()
Dim cnt As Long, SubCnt As Long, i As Long, lr As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
Dim fnd1 As Range, fnd2 As Range
cnt = Application.WorksheetFunction.CountIf(Columns(4), "Major*")
For i = 1 To cnt
Set fnd1 = Range("C:C").Find(Range("G" & i + 7), LookIn:=xlValues, lookat:=xlWhole)
Set fnd2 = Range("C:C").Find(Range("G" & i + 8), LookIn:=xlValues, lookat:=xlWhole)
If i = cnt Then
SubCnt = Application.WorksheetFunction.CountIf(Range(Cells(fnd1.Row + 1, 3), Cells(lr, 3)), "*")
Else
SubCnt = Application.WorksheetFunction.CountIf(Range(Cells(fnd1.Row + 1, 3), Cells(fnd2.Row - 1, 3)), "*")
End If
Range("H" & i + 7).Value = SubCnt
Next i
End Sub
Bookmarks