I'm trying to RemoveDuplicates for each column EX) removeduplicates for A1:A100, columns=1 / B1:B10-, colums=2......so on
and the boldes codes don't work please help me out
Sub DeleteDulpicates()
Dim i As Integer
Dim X As Integer
Dim Endrow As Long
Dim Endcolumn As Long
Dim sht As Worksheet
Set sht = ActiveSheet
Endrow = Cells.SpecialCells(xlCellTypeLastCell).Row
Endcolumn = sht.Cells.SpecialCells(xlCellTypeLastCell).Column
For i = 1 To Endcolumn
***Range(sht.Cells(i, 1), sht.Cells(i, 15000)).RemoveDuplicates Columns:=i, Header:=xlNo***
Next
End Sub
Columns:=Array(i)may fix the error. (also Endrow doesn't qualify the worksheet (i.e.sht.is missing. learn.microsoft.com/en-us/office/vba/api/…1.variant2.zero-based array, and3.it has to be evaluated if you don't want to hard-code it (e.g.Array(1, 2)). Check out this example.