I have a range roughly 2000 rows and 7 columns. I was looking for duplicate values in two columns direct from the excel worksheet. This was very slow so I decided to transfer the two columns of data to an array ( LoadAr) and do the duplicate search on that recording the row no of the duplicates found on another array (DupsAr). The code for loading the Array is this:-
[CODE]Sub Doubles2()
Dim nextRow As Long
Dim lastRow As Long
Dim thisRow As Long
Dim DupsAr As Variant
Dim LoadAr As Variant
Dim CellVal As Variant
Application.ScreenUpdating = False
With Sheets("Sheet1")
nextRow = 0
lastRow = WorksheetFunction.CountA(.Range("C:C"))
ReDim DupsAr(lastRow, 0)
ReDim LoadAr(lastRow, 1)
For x = 0 To lastRow
For y = 0 To 1
1 LoadAr(x, 0) = .Range(Cells(x + 1, 2)).Value
2 LoadAr(x, 1)= .Range(Cells(x+1,5).Value
Next y
Next x
'code to find duplicates in LoadAr put the RowN0 in the array DupsAr then transfer it to col J
For a = 1 To lastRow
Sheets("Sheet1").Range(Cells(a, 10).Value) = DupsAr(a, 1)
Next a
End With
Application.ScreenUpdating = True
End Sub
[/
I get an
Application defined or Object defined error at lines 1 & 2, and I cant see what is wrong with those lines. Can someone tell me please?
Bookmarks