Consulting

Results 1 to 1 of 1

Thread: MS Project Pro 2016 Macro Help

  1. #1

    MS Project Pro 2016 Macro Help

    I'm quite new to VBA and am struggling to write a macro that will copy data from a custom Resource field to a custom Task field. Specifically, I want TaskField.Number13 to equal ResourceField.Number1 based on the Resource Name assigned to a task.

    This is what I have so far...

    Sub CopyResourceSkillLevel()
    ' Copy Resource Skill Level from Resource Sheet to Task Sheet
        Dim res As Resource
        For Each res In ActiveProject.Resources
        For Each asn In res.Assignments
            ResourceField.Number1
        Next asn
        Next res
        ' transfer data to show in the Task Usage view
        Dim tsk As Task
        For Each tsk In ActiveProject.Tasks
        For Each asn In tsk.TaskField
            ' use only ONE of the following:
            ' to show the task's value use
            ' asn.Text2 = tsk.Text2
            ' to show the resource's value use
            res.ResourceField.Name = tsk.TaskField = "Resource Names"
            tsk.TaskField.Number13 = res.ResourceField.Number1
        Next asn
        Next tsk
    End Sub
    Any suggestions on how to achieve what I'm trying to do? I'm really hoping to not have to do it manually for each task.
    Last edited by Aussiebear; 04-27-2023 at 01:02 AM. Reason: Adjusted the code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •