Copying entire row from multiple worksheets to one target worksheet using a command button

Uhtred Bebbanburg

New Member
Joined
Apr 15, 2023
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I'm trying to copy select rows from multiple sheets only when the value in column B is "Y".

I need to do this from multiple worksheets to one target worksheet without overwriting the values e.g. it will check for the last row that has a value and put the new entry in the row below.

I have managed to get this to work based on entering the "Y" value in column B of a particular worksheet. Code for this is:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errhandler
Application.EnableEvents = False

lastrow = Sheets("Change Tracker 2").Cells(Rows.Count, "A").End(xlUp).Row

If Target.Column = 2 And UCase(Target.Value) = "Y" Then
Cells(Target.Row, Target.Column).EntireRow.Copy Destination:= _
Sheets("Change Tracker 2").Range("A" & lastrow + 1).End(xlUp).Offset(1)
End If
errhandler:
Application.EnableEvents = True
End Sub

However the problem with this is if updates are made to the active sheet that is being copied from after the "Y" has been entered in column B for that row these changes won't show up in the target sheet that is being copied to, that sheet being "Change Tracker 2".
I therefore want to modify this code to work with a command button that can run through multiple named worksheets and copy the rows in the same fashion collating them all into the "Change Tracker 2" worksheet. Will also clear all the values from the "Change Tracker 2" worksheet before it does this so basically when the user wants to the can collate all of the rows that meet the criteria by pressing the button and they are all up to date.
Have tried this but don't know how to set the worksheets to copy from. Code I have so far is:



Sub Button2_Click()

On Error GoTo errhandler
Application.EnableEvents = False



lastrow = Sheets("Change Tracker 2").Cells(Rows.Count, "A").End(xlUp).Row

Set WorkRng = Sheets("General").Range("A7:M105")

If Target.Column = 2 And UCase(Target.Value) = "Y" Then
Cells(Target.Row, Target.Column).EntireRow.Copy Destination:= _
Sheets("Change Tracker 2").Range("A" & lastrow + 1).End(xlUp).Offset(1)
End If
errhandler:
Application.EnableEvents = True
End Sub


As you can see I've attempted (and failed) to set the working sheet to copy from but only one, will need multiple and haven't added the clear function for the sheet yet (though I should be able to manage this at least)

Hope this makes sense and if anyone can help would be much appreciated.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Back to the drawing board I think. What are the names of the sheets you want to copy from, and do they all have the same structure? Do they all have header rows, and what row is that on. Does the data start from row 7 or 8 on each sheet (I notice you specify Set WorkRng = Sheets("General").Range("A7:M105")) on your new code. Do you want the rows deleted after they've been copied or left in place. It would help those trying to help you if you could provide samples of your data using the XL2BB - Excel Range to BBCode
 
Upvote 0
Back to the drawing board I think. What are the names of the sheets you want to copy from, and do they all have the same structure? Do they all have header rows, and what row is that on. Does the data start from row 7 or 8 on each sheet (I notice you specify Set WorkRng = Sheets("General").Range("A7:M105")) on your new code. Do you want the rows deleted after they've been copied or left in place. It would help those trying to help you if you could provide samples of your data using the XL2BB - Excel Range to BBCode
Thanks so much for your response. Understand more detail is needed and will try and be as thorough as possible. Details below:

There are 5 sheet I want to copy the entire row from to Collate into the "Change Tracker 2" sheet. I do not want to delete the source data. The use case is a follows:

- User wants to collate all of the rows marked as "Y" in the "Change" column for the following worksheets:
- General
- Sheet 1
- Sheet 2
- Sheet 3
- Sheet 4
- The user wants to do this whenever they wish about ensuring that the copy of the row(s) in the "Change Tracker 2" sheet matches the data from the sheet it is copied from. (Hence why my previous solution didn't really work as the practicalities of initiating the copy by putting "Y" in the "Change" column means it is too easy to update the other columns in the row after the fact and the copied version of the row will be out of date)

- The user does not want to delete the source data. It should remain in place.
- When the user initiates the copy it should populate the "Change Tracker sheet" with the source data as specified above, including all the columns in the row and add them without spaces between them.
- When a user has previously initiated a copy and chooses to do so again it should not add the new data to the bottom of the existing list on the "Change Tracker 2" sheet but replace this data. E.g. it is a capture of all the rows marked as change across all the rows at the time of initiating the copy from the above defined sheets only.

(please note there a "Version" change control sheet before the "General" Sheet that can be ignored.

My thought are a command button would be the best way to achieve the above but am open to suggestions. This could go on the "Change tracker 2" sheet which would make sense if going this way.


General Sheet (to copy from based on the above mentioned rules)

Configuration Summary Document v2.2.xlsm
ABCDEFGHIJKLMN
1
2
3
4Date:n/a
5
6SeqChange?Change typeDate RaisedRaised byAreaIssueAction RequiredAction OwnerDue DateStatusOutcomeNotes (Please include name & date.
7CONF-0001YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer15/04/2023MeTest General 1End of row test 1
8CONF-0002NDo not Copy this data to "Change Tracker 2" sheet. 16/04/2023Myself Test General 2End of row test 2
9CONF-0003YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer17/04/2023IreneTest General 3End of row test 3
10CONF-0004NDo not Copy this data to "Change Tracker 2" sheet. 18/04/2023MeTest General 4End of row test 4
11CONF-0005YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer19/04/2023Myself Test General 5End of row test 5
12CONF-0006NDo not Copy this data to "Change Tracker 2" sheet. 20/04/2023IreneTest General 6End of row test 6
13CONF-0007YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer21/04/2023MeTest General 7End of row test 7
14CONF-0008NDo not Copy this data to "Change Tracker 2" sheet. 22/04/2023Myself Test General 8End of row test 8
15CONF-0009YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer23/04/2023IreneTest General 9End of row test 9
16CONF-0010NDo not Copy this data to "Change Tracker 2" sheet. 24/04/2023MeTest General 10End of row test 10
17CONF-0011YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer25/04/2023Myself Test General 11End of row test 11
18CONF-0012NDo not Copy this data to "Change Tracker 2" sheet. 26/04/2023IreneTest General 12End of row test 12
19CONF-0013YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer27/04/2023MeTest General 13End of row test 13
20CONF-0014NDo not Copy this data to "Change Tracker 2" sheet. 28/04/2023Myself Test General 14End of row test 14
21CONF-0015YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer29/04/2023IreneTest General 15End of row test 15
22CONF-0016
23CONF-0017
24CONF-0018
General
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B7:N106Expression=IF($L7="COMPLETE",TRUE,FALSE)textNO
Cells with Data Validation
CellAllowCriteria
L7:L24List=Status
I7:I24List=Action_Required
F7:F106Any value
G7:G106List=Nimbus_Area


Sheet 1 (to copy from based on the above mentioned rules)

Configuration Summary Document v2.2.xlsm
ABCDEFGHIJKLMN
1
2
3
4Date:n/a
5
6SeqChange?Change typeDate RaisedRaised byNIMBUS AreaIssueAction RequiredAction OwnerDue DateStatusOutcomeNotes (Please include name & date.
7WS-PH-0001YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer15/04/2023MeTest Sheet 1 - 1End of row test 1
8WS-PH-0002NDo not Copy this data to "Change Tracker 2" sheet. 16/04/2023Myself Test Sheet 1 - 2End of row test 2
9WS-PH-0003YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer17/04/2023IreneTest Sheet 1 - 3End of row test 3
10WS-PH-0004NDo not Copy this data to "Change Tracker 2" sheet. 18/04/2023MeTest Sheet 1 - 4End of row test 4
11WS-PH-0005YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer19/04/2023Myself Test Sheet 1 - 5End of row test 5
12WS-PH-0006NDo not Copy this data to "Change Tracker 2" sheet. 20/04/2023IreneTest Sheet 1 - 6End of row test 6
13WS-PH-0007YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer21/04/2023MeTest Sheet 1 - 7End of row test 7
14WS-PH-0008NDo not Copy this data to "Change Tracker 2" sheet. 22/04/2023Myself Test Sheet 1 - 8End of row test 8
15WS-PH-0009YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer23/04/2023IreneTest Sheet 1 - 9End of row test 9
16WS-PH-0010NDo not Copy this data to "Change Tracker 2" sheet. 24/04/2023MeTest Sheet 1 - 10End of row test 10
17WS-PH-0011YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer25/04/2023Myself Test Sheet 1 - 11End of row test 11
18WS-PH-0012NDo not Copy this data to "Change Tracker 2" sheet. 26/04/2023IreneTest Sheet 1 - 12End of row test 12
19WS-PH-0013YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer27/04/2023MeTest Sheet 1 - 13End of row test 13
20WS-PH-0014NDo not Copy this data to "Change Tracker 2" sheet. 28/04/2023Myself Test Sheet 1 - 14End of row test 14
21WS-PH-0015YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer29/04/2023IreneTest Sheet 1 - 15End of row test 15
22WS-PH-0016
23WS-PH-0017
24WS-PH-0018
25WS-PH-0019
Sheet 1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E7:N21Expression=IF($L7="COMPLETE",TRUE,FALSE)textNO
C7:D106Expression=IF($K7="COMPLETE",TRUE,FALSE)textNO
B7:B106,E22:N106Expression=IF($L7="COMPLETE",TRUE,FALSE)textNO
Cells with Data Validation
CellAllowCriteria
L7:L25List=Status
I7:I25List=Action_Required
F7:F106Any value
G7:G106List=Nimbus_Area


Sheet 2 (to copy from based on the above mentioned rules)
Configuration Summary Document v2.2.xlsm
ABCDEFGHIJKLMN
1
2
3
4Date:28th March 2023
5
6SeqChange?Change typeDate RaisedRaised byNIMBUS AreaIssueAction RequiredAction OwnerDue DateStatusOutcomeNotes (Please include name & date.
7WS-CSE-0001YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer15/04/2023MeTest Sheet 2 - 1End of row test 1
8WS-CSE-0002NDo not Copy this data to "Change Tracker 2" sheet. 16/04/2023Myself Test Sheet 2 - 2End of row test 2
9WS-CSE-0003YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer17/04/2023IreneTest Sheet 2 - 3End of row test 3
10WS-CSE-0004NDo not Copy this data to "Change Tracker 2" sheet. 18/04/2023MeTest Sheet 2 - 4End of row test 4
11WS-CSE-0005YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer19/04/2023Myself Test Sheet 2 - 5End of row test 5
12WS-CSE-0006NDo not Copy this data to "Change Tracker 2" sheet. 20/04/2023IreneTest Sheet 2 - 6End of row test 6
13WS-CSE-0007YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer21/04/2023MeTest Sheet 2 - 7End of row test 7
14WS-CSE-0008NDo not Copy this data to "Change Tracker 2" sheet. 22/04/2023Myself Test Sheet 2 - 8End of row test 8
15WS-CSE-0009YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer23/04/2023IreneTest Sheet 2 - 9End of row test 9
16WS-CSE-0010NDo not Copy this data to "Change Tracker 2" sheet. 24/04/2023MeTest Sheet 2 - 10End of row test 10
17WS-CSE-0011YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer25/04/2023Myself Test Sheet 2 - 11End of row test 11
18WS-CSE-0012NDo not Copy this data to "Change Tracker 2" sheet. 26/04/2023IreneTest Sheet 2 - 12End of row test 12
19WS-CSE-0013YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer27/04/2023MeTest Sheet 2 - 13End of row test 13
20WS-CSE-0014NDo not Copy this data to "Change Tracker 2" sheet. 28/04/2023Myself Test Sheet 2 - 14End of row test 14
21WS-CSE-0015YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer29/04/2023IreneTest Sheet 2 - 15End of row test 15
22WS-CSE-0016
23WS-CSE-0017
24WS-CSE-0018
Sheet 2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E7:N21Expression=IF($L7="COMPLETE",TRUE,FALSE)textNO
C7:D106Expression=IF($K7="COMPLETE",TRUE,FALSE)textNO
G53,I46:N74,B7:B106,E22:N45,E54:G74,E75:N106,E53,E46:G52Expression=IF($L7="COMPLETE",TRUE,FALSE)textNO
Cells with Data Validation
CellAllowCriteria
I7:I24List=Action_Required
L7:L24List=Status
F7:F43Any value
G7:G106List=Nimbus_Area


Sheet 3 (to copy from based on the above mentioned rules)

Configuration Summary Document v2.2.xlsm
ABCDEFGHIJKLMN
1
2
3
4Date:4th April 2023
5
6SeqChange?Change typeDate RaisedRaised byNIMBUS AreaIssueAction RequiredAction OwnerDue DateStatusOutcomeNotes (Please include name & date.
7WS-FOS-0001YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer15/04/2023MeTest Sheet 3 - 1End of row test 1
8WS-FOS-0002NDo not Copy this data to "Change Tracker 2" sheet. 16/04/2023Myself Test Sheet 3 - 2End of row test 2
9WS-FOS-0003YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer17/04/2023IreneTest Sheet 3 - 3End of row test 3
10WS-FOS-0004NDo not Copy this data to "Change Tracker 2" sheet. 18/04/2023MeTest Sheet 3 - 4End of row test 4
11WS-FOS-0005YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer19/04/2023Myself Test Sheet 3 - 5End of row test 5
12WS-FOS-0006NDo not Copy this data to "Change Tracker 2" sheet. 20/04/2023IreneTest Sheet 3 - 6End of row test 6
13WS-FOS-0007YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer21/04/2023MeTest Sheet 3 - 7End of row test 7
14WS-FOS-0008NDo not Copy this data to "Change Tracker 2" sheet. 22/04/2023Myself Test Sheet 3 - 8End of row test 8
15WS-FOS-0009YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer23/04/2023IreneTest Sheet 3 - 9End of row test 9
16WS-FOS-0010NDo not Copy this data to "Change Tracker 2" sheet. 24/04/2023MeTest Sheet 3 - 10End of row test 10
17WS-FOS-0011YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer25/04/2023Myself Test Sheet 3 - 11End of row test 11
18WS-FOS-0012NDo not Copy this data to "Change Tracker 2" sheet. 26/04/2023IreneTest Sheet 3 - 12End of row test 12
19WS-FOS-0013YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer27/04/2023MeTest Sheet 3 - 13End of row test 13
20WS-FOS-0014NDo not Copy this data to "Change Tracker 2" sheet. 28/04/2023Myself Test Sheet 3 - 14End of row test 14
21WS-FOS-0015YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer29/04/2023IreneTest Sheet 3 - 15End of row test 15
22WS-FOS-0016
23WS-FOS-0017
24WS-FOS-0018
25WS-FOS-0019
Sheet 3
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E7:N21Expression=IF($L7="COMPLETE",TRUE,FALSE)textNO
C7:D106Expression=IF($K7="COMPLETE",TRUE,FALSE)textNO
M36:N42,I36:J36,I37:I41,L36:L41,B7:B106,E22:N35,E36:F42,E43:N106Expression=IF($L7="COMPLETE",TRUE,FALSE)textNO
Cells with Data Validation
CellAllowCriteria
L7:L25List=Status
I7:I21List=Action_Required
F7:F21Any value
G7:G21List=Nimbus_Area


Sheet 4 (to copy from based on the above mentioned rules)

Configuration Summary Document v2.2.xlsm
ABCDEFGHIJKLMN
1
2
3
4Date:11th April 2023
5
6SeqChange?Change typeDate RaisedRaised byNIMBUS AreaIssueAction RequiredAction OwnerDue DateStatusOutcomeNotes (Please include name & date.
7WS-VII-0001YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer15/04/2023MeTest Sheet 4 - 1End of row test 1
8WS-VII-0002NDo not Copy this data to "Change Tracker 2" sheet. 16/04/2023Myself Test Sheet 4 - 2End of row test 2
9WS-VII-0003YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer17/04/2023IreneTest Sheet 4 - 3End of row test 3
10WS-VII-0004NDo not Copy this data to "Change Tracker 2" sheet. 18/04/2023MeTest Sheet 4 - 4End of row test 4
11WS-VII-0005YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer19/04/2023Myself Test Sheet 4 - 5End of row test 5
12WS-VII-0006NDo not Copy this data to "Change Tracker 2" sheet. 20/04/2023IreneTest Sheet 4 - 6End of row test 6
13WS-VII-0007YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer21/04/2023MeTest Sheet 4 - 7End of row test 7
14WS-VII-0008NDo not Copy this data to "Change Tracker 2" sheet. 22/04/2023Myself Test Sheet 4 - 8End of row test 8
15WS-VII-0009YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer23/04/2023IreneTest Sheet 4 - 9End of row test 9
16WS-VII-0010NDo not Copy this data to "Change Tracker 2" sheet. 24/04/2023MeTest Sheet 4 - 10End of row test 10
17WS-VII-0011YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer25/04/2023Myself Test Sheet 4 - 11End of row test 11
18WS-VII-0012NDo not Copy this data to "Change Tracker 2" sheet. 26/04/2023IreneTest Sheet 4 - 12End of row test 12
19WS-VII-0013YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer27/04/2023MeTest Sheet 4 - 13End of row test 13
20WS-VII-0014NDo not Copy this data to "Change Tracker 2" sheet. 28/04/2023Myself Test Sheet 4 - 14End of row test 14
21WS-VII-0015YCopy this data to "Change Tracker 2" sheet. Do not delete after transfer29/04/2023IreneTest Sheet 4 - 15End of row test 15
22WS-VII-0016
23WS-VII-0017
24WS-VII-0018
Sheet 4
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E7:N21Expression=IF($L7="COMPLETE",TRUE,FALSE)textNO
C7:D106Expression=IF($K7="COMPLETE",TRUE,FALSE)textNO
B7:B106,E22:N106Expression=IF($L7="COMPLETE",TRUE,FALSE)textNO
Cells with Data Validation
CellAllowCriteria
F7:F106Any value
G7:G106List=Nimbus_Area
I7:I24List=Action_Required
L7:L24List=Status


Change Tracker 2 (to copy to based on the above mentioned rules so would end up with all the rows marked as "Y" in the "Change?" column for the above sheets)

Configuration Summary Document v2.2.xlsm
ABCDEFGHIJKLMN
1
2
3
4Date:11th April 2023
5
6SeqChange?Change typeDate RaisedRaised byNIMBUS AreaIssueAction RequiredAction OwnerDue DateStatusOutcomeNotes (Please include name & date.
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Change Tracker 2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B7:N7Expression=IF($L7="COMPLETE",TRUE,FALSE)textNO
B8:N8Expression=IF($L8="COMPLETE",TRUE,FALSE)textNO
B9:N9Expression=IF($L9="COMPLETE",TRUE,FALSE)textNO
B12:N12Expression=IF($L12="COMPLETE",TRUE,FALSE)textNO
B11:N11Expression=IF($L11="COMPLETE",TRUE,FALSE)textNO
B10:N10Expression=IF($L10="COMPLETE",TRUE,FALSE)textNO
Cells with Data Validation
CellAllowCriteria
F7:F12Any value
G7:G12List=Nimbus_Area
I7:I12List=Action_Required
L7:L12List=Status
 
Upvote 0
Thank you for the very detailed response - it makes life so much easier (y)
Please try the following on a copy of your file. I'd be surprised if it works perfectly first time, but it's a start.

VBA Code:
Option Explicit
Sub Change_Tracker()
    On Error GoTo Escape
    Application.EnableEvents = False
    Application.ScreenUpdating = False
    Dim ws As Worksheet, ws1 As Worksheet
    Set ws1 = Worksheets("Change Tracker 2")
    
    Dim SheetList, i As Long, LRow As Long
    SheetList = Array("General", "Sheet 1", "Sheet 2", "Sheet 3", "Sheet 4")
    
    For i = LBound(SheetList) To UBound(SheetList)
        With Worksheets(SheetList(i)).Range("B6:N6")
            .AutoFilter 2, "Y"
            LRow = ws1.Cells(Rows.Count, 2).End(xlUp).Row + 1
            .CurrentRegion.Offset(1).Copy ws1.Cells(LRow, 2)
            .AutoFilter
        End With
    Next i
    With ws1.Range("B6:N" & Cells.Find("*", , xlFormulas, , xlByRows, xlPrevious).Row)
        .RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13), Header:=xlYes
    End With
    
Continue:
    Application.EnableEvents = True
    Exit Sub
Escape:
    MsgBox "Error " & Err.Number & ": " & Err.Description
    Resume Continue
End Sub
 
Upvote 1
Solution
Thank you for the very detailed response - it makes life so much easier (y)
Please try the following on a copy of your file. I'd be surprised if it works perfectly first time, but it's a start.

VBA Code:
Option Explicit
Sub Change_Tracker()
    On Error GoTo Escape
    Application.EnableEvents = False
    Application.ScreenUpdating = False
    Dim ws As Worksheet, ws1 As Worksheet
    Set ws1 = Worksheets("Change Tracker 2")
   
    Dim SheetList, i As Long, LRow As Long
    SheetList = Array("General", "Sheet 1", "Sheet 2", "Sheet 3", "Sheet 4")
   
    For i = LBound(SheetList) To UBound(SheetList)
        With Worksheets(SheetList(i)).Range("B6:N6")
            .AutoFilter 2, "Y"
            LRow = ws1.Cells(Rows.Count, 2).End(xlUp).Row + 1
            .CurrentRegion.Offset(1).Copy ws1.Cells(LRow, 2)
            .AutoFilter
        End With
    Next i
    With ws1.Range("B6:N" & Cells.Find("*", , xlFormulas, , xlByRows, xlPrevious).Row)
        .RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13), Header:=xlYes
    End With
   
Continue:
    Application.EnableEvents = True
    Exit Sub
Escape:
    MsgBox "Error " & Err.Number & ": " & Err.Description
    Resume Continue
End Sub

You sir are a genius. This worked straight away just had to assign it to the button. Only thing I added was to clear the "Change Tracker 2" worksheet at the start of the routine.

No need to thank me for the detailed response least I can do when you're helping me out. I really appreciate it so much.

I'm a business analyst so used to writing detailed requirements for developers and architects. Dabbled a little in coding myself when I was a systems implementation consultant but was never my forte. Was always better on the business side.

If you ever need help writing functional/non func/system requirements etc. give me a shout so I can return the favour.

Thanks again

Dan
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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