OK...I added a row, so now I want to have the code start looking in row 6. So I changed sh.Range(sh.Cells(5, i) to sh.Range(sh.Cells(6, i)...and it works. I now know what it is doing (sh.Cells(6,i) means the code begins in cell A6.Try this
Sub RemoveDuplicate() Dim i As Long, sh As Worksheet Set sh = Sheets("Matrix") For i = 1 To sh.Cells.Find("*", , xlValues, , xlByColumns, xlPrevious).Column sh.Range(sh.Cells(5, i), sh.Cells(Rows.Count, i)).RemoveDuplicates Columns:=1, Header:=xlYes Next End Sub
If I were to want the code to begin in say E6, I would change i=6, and keep sh.Range(sh.Cells(6, i), the same. Which I believe would make the code start looking for duplicates in cell E6.
Also...I almost forgot, I changed Header:=xl Yes to No
I believe everything is working correctly, because I now know where the code begins to look for duplicates.
thanks for all the help