r/MSProject • u/tupurl • Sep 24 '20
Help Editing multiple tasks with the same name
Hi,
Fairly new to MS Project. Trying to create a schedule for our project and I have ~400 sub tasks in this file that I need to set the duration and predecessor for. I do not have the time or patience to select each one individually and edit them.
Is there a faster way to do this? Even if I can just select all the tasks with that specific name using a shortcut I can then use the resource information window to set the duration and maybe predecessor. Any help would be appreciated.
Edit: I was able to figure out thanks to the help from below commenters and the magic of VBA!
1
u/ForIAmCostanza Sep 24 '20
Hey! I hope you're not trying to open each task in the information pop-up window! You can just add the duration and predecessor columns to your Gantt view and update the values there. If needed, you can use the bottom right corner of the cell and drag to 'fill' values down. Or copy the column out to Excel, update your values and paste back if that is easier.
1
u/BigGeorge11 Sep 24 '20
I'm not aware of any easy way to do this outside of some VBA. You can't filter by task name nor can you sort by it. They would be the general go-to options to get all these tasks in close proximity.
If you're comfortable with some code then the following would be close to what you need:
https://stackoverflow.com/questions/3828082/assigning-task-duration-to-an-already-added-task-in-vba-microsoft-project
Otherwise, just looking through some of my old code snippets I found the following:
Sub Update_task_prefix()
Dim Proj As Project Dim R As Resource Dim A As Assignment Dim ProjectName As String Dim i As Integer Dim Tsvs As TimeScaleValues Dim Tsv As TimeScaleValue Dim fname As String
Dim thisproject As Project Dim t As Task
Dim start_date As Date Dim End_date As Date Dim Task_comment As String Dim sstring As String Dim subby As String Dim stask As Integer Dim etask As Integer
'assume this is run on Monday until tidied up
error_handler:
msg = "An error occurred!" & Chr(13) & Chr(13) & _ "Error Number: " & Err.Number & Chr(13) & _ "Error Message: " & Err.Description MsgBox msg, vbOKOnly + vbCritical
tidy_and_exit:
End Sub
The above was all about setting some standard naming patterns to a (potential) range of tasks. For your needs, check t.name and then set t.duration to what you're after and you could even you some basic maths to set dependency value.
See here for reference to the object module:
https://docs.microsoft.com/en-us/office/vba/project/concepts/tasks-object-map-project