Jared_Jones_23
New Member
- Joined
- Jun 24, 2011
- Messages
- 34
I have a code that checks certain columns in different rows to see if they are considered a duplicate then deletes them. The problem is I have about 15 columns that need checked and im wondering if it check through an array of those columns. Heres my code and array.
Any suggestions are appreciated, thank you,
Jared
The array of columns is myarray=array(1,2,8,12,14,15,16,18,20,21,22,23,24,25,28)
Sub rows()
'using nested do while loops
'we start at row 20 because row 19 has only the headers
x = 20
y = x + 1
Do While Cells(x, 1).Value <> ""
Do While Cells(y, 1).Value <> ""
If Cells(x, 1).Value = Cells(y, 1).Value And Cells(x, 2) = Cells(y, 2).Value And Cells(x, 8) = Cells(y, 8) ... (Instead of individually checking every cell i would like to loop through my array here)
'delete if duplicate
Cells(y, 1).EntireRow.Delete
Else
y = y + 1
End If
Loop
x = x + 1
y = x + 1
Loop
End Sub
Any suggestions are appreciated, thank you,
Jared
The array of columns is myarray=array(1,2,8,12,14,15,16,18,20,21,22,23,24,25,28)
Sub rows()
'using nested do while loops
'we start at row 20 because row 19 has only the headers
x = 20
y = x + 1
Do While Cells(x, 1).Value <> ""
Do While Cells(y, 1).Value <> ""
If Cells(x, 1).Value = Cells(y, 1).Value And Cells(x, 2) = Cells(y, 2).Value And Cells(x, 8) = Cells(y, 8) ... (Instead of individually checking every cell i would like to loop through my array here)
'delete if duplicate
Cells(y, 1).EntireRow.Delete
Else
y = y + 1
End If
Loop
x = x + 1
y = x + 1
Loop
End Sub