slozcannon
New Member
- Joined
- Jun 7, 2023
- Messages
- 8
- Office Version
- 365
- Platform
- Windows
Hi Everyone,
I have a workbook which has a master sheet and 5 secondary worksheets. More will be created with the same template going forward by date.
I need all data in secondary worksheets (column D of each one) to be copied in to worksheet 2 of the master sheet. Column D contains ID numbers.
I also need it to ONLY copy unique variables, so any repeated ID numbers get ignored.
Finally, I need i to offset to the next empty row, so it doesnt copy over existing data. Basically, as the weeks go by, any new ID numbers need to be copied in to the master copy, without duplicating or copying over whats already in the master sheet.
I managed to do these 2 subs so far but cant seem to combine the two? Can anyone please help?:
____________________________
Sub CopyStuff()
Range("X2:X12").Copy Sheets("Sheet1").Range("D" & Rows.Count).End(xlUp).Offset(1, 0)
End Sub
________________
Sub Unique_Values()
ThisWorkbook.Worksheets("08.06.2022").Activate
Range("D:D").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Range("X:X"), _
Unique:=True
Range("X2:X12").Copy Sheets("Sheet1").Range("D" & Rows.Count).End(xlUp).Offset(1, 0)
End Sub
____
Thanks alot!
I have a workbook which has a master sheet and 5 secondary worksheets. More will be created with the same template going forward by date.
I need all data in secondary worksheets (column D of each one) to be copied in to worksheet 2 of the master sheet. Column D contains ID numbers.
I also need it to ONLY copy unique variables, so any repeated ID numbers get ignored.
Finally, I need i to offset to the next empty row, so it doesnt copy over existing data. Basically, as the weeks go by, any new ID numbers need to be copied in to the master copy, without duplicating or copying over whats already in the master sheet.
I managed to do these 2 subs so far but cant seem to combine the two? Can anyone please help?:
____________________________
Sub CopyStuff()
Range("X2:X12").Copy Sheets("Sheet1").Range("D" & Rows.Count).End(xlUp).Offset(1, 0)
End Sub
________________
Sub Unique_Values()
ThisWorkbook.Worksheets("08.06.2022").Activate
Range("D:D").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Range("X:X"), _
Unique:=True
Range("X2:X12").Copy Sheets("Sheet1").Range("D" & Rows.Count).End(xlUp).Offset(1, 0)
End Sub
____
Thanks alot!