Hello. I am fairly new to VBA. I have a workbook name VBA test data sort with sheetname (Consolidated, RM WIP, Drying), all I want is to copy the 2 sheets (or maybe more additional sheets in the future) to consolidated sheets and remove duplicates since the 2 sheets will be the storage or data upload bt the end user.
1. copy 2 sheets into new sheets -Formula below - this is working but everytime i click my command button its continue copy everything in my consolidated.
Sub TEST()
Dim ws As Worksheet, lr As Long
lr = Sheets("Consolidated").Cells(Rows.Count, "A").End(xlUp).Row + 1
For Each ws In Worksheets
If ws.Name <> "Consolidated" Then
ws.Range("A2:K100000").Copy Sheets("Consolidated").Range("A" & lr)
lr = Sheets("Consolidated").Cells(Rows.Count, "A").End(xlUp).Row + 1
End If
Next ws
End Sub
2. Remove duplicates everytime i click the command button
3. auto filter, since my file base will be In and Out from C, A, B
1. copy 2 sheets into new sheets -Formula below - this is working but everytime i click my command button its continue copy everything in my consolidated.
Sub TEST()
Dim ws As Worksheet, lr As Long
lr = Sheets("Consolidated").Cells(Rows.Count, "A").End(xlUp).Row + 1
For Each ws In Worksheets
If ws.Name <> "Consolidated" Then
ws.Range("A2:K100000").Copy Sheets("Consolidated").Range("A" & lr)
lr = Sheets("Consolidated").Cells(Rows.Count, "A").End(xlUp).Row + 1
End If
Next ws
End Sub
2. Remove duplicates everytime i click the command button
3. auto filter, since my file base will be In and Out from C, A, B