Auto copy a row to another worksheet, then check the sheets for duplicates

Tigger118

New Member
Joined
Sep 28, 2011
Messages
2
Hi All,

I have an excel spreadsheet, which has a main database sheet. Within columns A & B, "Status" & "Sector" there are drop down menus and these can be changed. I have the following macro, which copies the row to another named sheet as and when these columns are changed, but I need a macro which will then check all the sheets, except the main database and the one which it just copied into for duplicates i.e.:

Joe Bloggs row - if I change this status from Active to Deactive then his details should just show on 3 worksheets - the main database the Deactive and then whatever his sector is.

Same applies if I change his sector from Public to Private, his details will show in main database, Private and whatever his status is.

Private Sub Worksheet_Change(ByVal Target As Range)
'Determine if Change was made to Column A or Column B
If Target.Column = 1 Or Target.Column = 2 Then
'If True, then determine the next available Row in Column A of Target sheet
nxtRw = Sheets(Target.Value).Range("A" & Rows.Count).End(xlUp).Row + 1
'Copy Row from Main sheet to Target sheet
Range(Target.Address).EntireRow.Copy _
Destination:=Sheets(Target.Value).Range("A" & nxtRw)
End If
End Sub

Many thanks in advance.
 

Some videos you may like

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Watch MrExcel Video

Forum statistics

Threads
1,122,499
Messages
5,596,515
Members
414,074
Latest member
Matthew Kakde

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
Top