Hello, we are getting data exported out of a Time Sheet from multiple Foremen. These Foremen might get the same employee or that employee might go to several different Foremen during the week. It must be a Macro and not a Pivot Table since we need to manipulate the data for different purposes. I am having a real hard time trying to figure out how to write a Macro to Look through several rows and compare each employee's name and if they are the same, it then needs to compare each day worked (could be 6 or 7 days and there is 2 cells per day because the can work 2 different jobs on 1 day) and if the job numbers are the same add the time together then clear the cell or delete the entire row if there is nothing left on it. I hope that makes sense, I apologize if it is a little confusing.
Now here is were is gets a little more complicated, because it can't just compare row 5 to row 6 then row 6 to row 7. Row 5, 6, and 7 could all be the same employee, but the job # could be blank on certain columns and if row 6 column AF is blank but row 5 and 7 have the same job # the comparison will only look at row 5, then 6, then 7 and they will not be merged.
For my test example here are the rows and columns I need to compare then merge.
Names start at D3 to D82, row 3 to 82, column 4
MondayJob1 at V3 to V82, row 3 to 82, column 22
MondayJob2 at W3 to W82, row 3 to 82, column 23
TuesdayJob1 at X3 to X82, row 3 to 82, column 24
TuesdayJob2 at Y3 to Y82, row 3 to 82, column 25
WednesdayJob1 at Z3 to Z82, row 3 to 82, column 26
WednesdayJob2 at AA3 to AA82, row 3 to 82, column 27
ThursdayJob1 at AB3 to AB82, row 3 to 82, column 28
ThursdayJob2 at AC3 to AC82, row 3 to 82, column 29
FridayJob1 at AD3 to AD82, row 3 to 82, column 30
FridayJob2 at AE3 to AE82, row 3 to 82, column 31
SaturdayJob1 at AF3 to AF82, row 3 to 82, column 32
SaturdayJob2 at AG3 to AG82, row 3 to 82, column 33
SundayJob1 at AH3 to AH82, row 3 to 82, column 34
SundayJob2 at AI3 to AI82, row 3 to 82, column 35
The Time values are in H through U, 8 through 21 and same row range of 3 to 82
Please let me know if you would like me to provide any additional information or the excel file. Thank you in advance for any time spent on this I really appreciate it.
Now here is were is gets a little more complicated, because it can't just compare row 5 to row 6 then row 6 to row 7. Row 5, 6, and 7 could all be the same employee, but the job # could be blank on certain columns and if row 6 column AF is blank but row 5 and 7 have the same job # the comparison will only look at row 5, then 6, then 7 and they will not be merged.
For my test example here are the rows and columns I need to compare then merge.
Names start at D3 to D82, row 3 to 82, column 4
MondayJob1 at V3 to V82, row 3 to 82, column 22
MondayJob2 at W3 to W82, row 3 to 82, column 23
TuesdayJob1 at X3 to X82, row 3 to 82, column 24
TuesdayJob2 at Y3 to Y82, row 3 to 82, column 25
WednesdayJob1 at Z3 to Z82, row 3 to 82, column 26
WednesdayJob2 at AA3 to AA82, row 3 to 82, column 27
ThursdayJob1 at AB3 to AB82, row 3 to 82, column 28
ThursdayJob2 at AC3 to AC82, row 3 to 82, column 29
FridayJob1 at AD3 to AD82, row 3 to 82, column 30
FridayJob2 at AE3 to AE82, row 3 to 82, column 31
SaturdayJob1 at AF3 to AF82, row 3 to 82, column 32
SaturdayJob2 at AG3 to AG82, row 3 to 82, column 33
SundayJob1 at AH3 to AH82, row 3 to 82, column 34
SundayJob2 at AI3 to AI82, row 3 to 82, column 35
The Time values are in H through U, 8 through 21 and same row range of 3 to 82
Please let me know if you would like me to provide any additional information or the excel file. Thank you in advance for any time spent on this I really appreciate it.