Looping through rows, copy and paste data by values

iRachel

New Member
Joined
Nov 8, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,

I have been working on generating a certified payroll report and I'm almost finished but I'm getting hung up on creating a loop that I need...

I am trying to loop through rows and compare project number, employee code number, the employee task code, and if the hours they worked were overtime or regular time. Currently the employee hours are separated into two lines for overtime and regular time by an accounting software we use. I would like to combine this information by copying the employee's over time hours and pasting the data into the record that holds their regular hours.

Here's an example of the data I'm working with.


Screenshot 2022-11-08 091142.png

If the hours type column (H) value is "O" I want to copy cells I2:P2 then find the record that matches the project code, emp, and work class code (columns B, A, and E) and paste the data into the record with the regular hours. Offsetting the data into the R:Z range as shown in the thumbnail below. Then preferably deleting the over time record (but that is not necessary right now the record highlighted in red is to show that it's to be deleted).

Screenshot After.png

Note, the amount of records will change each week, so I need a loop that will be dynamic in counting the number of rows.

Any and all help would be greatly appreciated!

Thank you so much for time, 🙏🙏🙏🙏
Rachel
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top