Task Name Field, "Blank" ("") in 2007, "Empty" (Empty) in 2010, HOW TO FILD/FILTER for empty? RRS feed

  • Question

  • In MS Project 2007, I can use VBA code in Excel and determine if the selected task “Name” field is blanks by using the code “pj.Activecell.text <> “”.

    In MS Project 2010, blank name cells are no longer “” (or blank), they are “Empty”. How do users filter for a non-standard value of “empty” then the text of “empty” is not in the task “Name” cell?

    Friday, July 18, 2014 12:00 PM

All replies

  • Hi Dan,

    I'm not sure to understand. In Project 2010, when you filter on the task name, the "blank" value is displayed for blank rows.

    Hope this helps,

    Guillaume Rouyre, MBA, MCP, MCTS |

    Friday, July 18, 2014 12:48 PM
  • Thank you for your reply, however my issue is to do the same in VBA code. Using your example. Re-do all your steps after you "turn on" macro writer. Once you complete your steps, turn off the macro writer. Then call up the macro and run.

    Let me know your results, thanks!

    Saturday, July 19, 2014 5:56 PM
  • Hi Dan,

    Since I almost know nothing about VBA and I can only read but not write code, I'll let John or Rod (VBA kings on this forum) jump in.

    But here is what I go recording the macro:

    Sub Macro1()
        SetAutoFilter FieldName:="Name", FilterType:=pjAutoFilterIn, Criteria1:=""
    End Sub

    Also ensure to have the latest version of Project 2010 since I noticed different behaviour with blank lines with 2 different versions.

    Hope this helps,

    Guillaume Rouyre, MBA, MCP, MCTS |

    Saturday, July 19, 2014 6:13 PM
  • Dan,

    I'm not sure I complete follow what you are saying. As far as I know there is no difference among Project versions when examining text string data. If the Task Name field is blank (i.e. no entry) then a simple test for "" will flag that task line. If however there is no data on the entire task line then it is not blank, it is null and that requires a different test. The following simple macro will set the Flag1 field true for any tasks that have no entry in the Task Name field. The code will also properly handle null task rows.

    Sub ChkforBlankTskNam()
    Dim t As Task
    For Each t In ActiveProject.Tasks
        If Not t Is Nothing Then
            If t.Name = "" Then t.Flag1 = True
        End If
    Next t
    End Sub

    Now, what exactly is your end goal?


    Saturday, July 19, 2014 8:32 PM
  • Guillaume,

    Rod is the VBA "king". I'm only a jester.


    Saturday, July 19, 2014 8:38 PM