Forum Discussion
Help on .mpp
- Jan 28, 2024
My knowledge of the topic is limited, but since no one has answered yet, even though it has been read many times, I posted the question in various AIs and found the above suggested solution for you. The proposed solution is untested.
To achieve this in Excel, you can create a VBA macro to copy the required number of rows from the "Job" tab to the "Pay" tab, duplicate the data if needed, and increment the values in column B. Here is a sample VBA code for your specific requirements:
Sub CopyRowsAndIncrement() Dim jobSheet As Worksheet Dim paySheet As Worksheet Dim lastRowJob As Long Dim rowCount As Long Dim i As Long ' Set references to the sheets Set jobSheet = ThisWorkbook.Sheets("Job") Set paySheet = ThisWorkbook.Sheets("Pay") ' Find the last row in the "Job" sheet lastRowJob = jobSheet.Cells(jobSheet.Rows.Count, "A").End(xlUp).Row ' Clear existing data in "Pay" sheet paySheet.Cells.Clear ' Copy and duplicate data to "Pay" sheet rowCount = 2 ' Start from row 2 in "Pay" sheet For i = 1 To lastRowJob paySheet.Cells(rowCount, 1).Value = jobSheet.Cells(i, 1).Value paySheet.Cells(rowCount, 2).Value = i ' Incrementing values in column B rowCount = rowCount + 1 Next i ' Update the number of rows to match the "Job" sheet paySheet.Rows(rowCount & ":" & paySheet.Rows.Count).Delete ' Inform the user that the operation is complete MsgBox "Rows copied and incremented successfully!", vbInformation End Sub
- Open your Excel workbook.
- Press Alt + F11 to open the Visual Basic for Applications (VBA) editor.
- In the VBA editor, right-click on "VBAProject (Your Workbook Name)" in the left pane, select Insert > Module. This will create a new module where you can paste the following code.
- Copy and paste the following VBA code into the module:
- Close the VBA editor.
- Now, you can add a button to your Excel sheet and assign the macro to it.
- Go to the "Developer" tab. If you don't see it, you may need to enable it in Excel options.
- Click on "Insert" and choose the "Button (Form Control)" option.
- Draw the button on your sheet.
- In the "Assign Macro" dialog, select CopyRowsAndIncrement and click "OK".
Now, whenever the user clicks the button, it will run the macro, copying the necessary rows from "Job" to "Pay", incrementing values in column B, and deleting any extra rows in "Pay". Adjust the sheet and cell references in the code if your actual data is in different locations.
My answers are voluntary and without guarantee!
Hope this will help you.
Was the answer useful? Mark as best response and Like it!
This will help all forum participants.
You are not using the Microsoft Project desktop application. You are using the relatively new Project for the Web application. Because of that, the tutorials you have seen are not relevant to you, so you should ignore them. You will need to create your own projects directly through the Project for the Web application. Hope this helps.