Removing Duplicates - Problem with Code

AndrewGKenneth

Board Regular
Joined
Aug 6, 2018
Messages
59
Dear all,

If anyone could help me with this query it would be much appreciated. I have created the following VBA code to remove duplicates in columns C and D of my worksheet.

Private Sub Worksheet_Change (ByVal Target as Range)
Activesheet.Range("C1:C100").Removeduplicates Columns:=1, Header:=xlYes
Activesheet.Range("D1:D100").Removeduplicates Columns:=1, Header:=xlYes
End Sub

This works fine and deletes the duplicates, as required but I will also get the following error message on my computer "Run-time error '-2147417848 (80010108) Automation Error The object invoked has disconnected from its clients" and then the excel sheet will then freeze up. However when used on another computer there is no issue and it works completely fine. Is there something I need to change on my excel settings to avoid this issue?

Thanks in advance, much appreciated.
Kind Regards,
Andrew
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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