Remove Duplicates command errors out

mgw1138

New Member
Joined
Mar 9, 2014
Messages
33
I process an input file created from a Database CSV file. This report has multiple cable Name entered Multiple times. After completion I want to remove duplicate cable names and put this in a Macro file by itself.

With Sheets("process")
.Unprotect
.Range("AE1").CurrentRegion.RemoveDuplicates Columns:=1, Header:=xlNo
.Protect
End With

I get an error that "This operation required the merged cells be identically sized".

There are no merged cells in column AE.

What am I missing.
Thanks
Michael
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
When you use .CurrentRegion, it will expand the selection to adjacent columns and rows that have data.

Try using
Code:
.Range("AE1:AE100").RemoveDuplicates Columns:=1, Header:=xlNo
(assuming your data has 100 rows - change 100 to last row of Column AE). If this works, then you can include code to figure out the last row of column AE and use that instead.

Regards,
ArvindYoga
 
Upvote 0
Thanks,

When I recorded the macro a dialog box asked if I wanted to expand the selection and said "NO". I assumed that the non-expansion was the default since no parameter was added. I did not realize that sometimes Excel asks for information with dialogs that is not reflected in the generated macro code.

Thanks that is an excellent bit to know.
Michael
 
Upvote 0

Forum statistics

Threads
1,222,905
Messages
6,168,950
Members
452,228
Latest member
just4jeffrey

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