I'm using VBA in Excel to remove duplicate values in an active range that is ~12000 rows long, and within a single column. However, when I run the RemoveDuplicates command on my selected range, it removes the entire rows that the duplicate values are present in. My code appears below:
Sub Dedupe()
Range("B1").Select
ActiveCell.Resize(12109, 1).Select
ActiveCell.RemoveDuplicates Columns:=1, Header:=xlYes
End Sub
My problem is that this deletes important data in the adjacent columns that I plan to dedupe next. I want to make the process loop through about 900 columns and repeat the dedupe for each column individually. Is there a way to use VBA code to remove the duplicate values in a current selection, but not delete the entire rows?
Thank you.