Hi
I have a code, which pulls data in few columns from a given data using RandBetween. To remove duplicates in column (except "X"), a code is given below:
This code is not giving the desired results, that is it stops itself before checking for any duplicates.
Kindly help in correction of this code.!
I have a code, which pulls data in few columns from a given data using RandBetween. To remove duplicates in column (except "X"), a code is given below:
This code is not giving the desired results, that is it stops itself before checking for any duplicates.
Kindly help in correction of this code.!
Code:
Sub VBA_Code_RandomwithRankModified()
Dim LastRow
Dim i As Integer
Dim j As Integer
LastRow = 17
LastCol = 9
Do
For i = 2 To LastRow
For j = 5 To LastCol
Cells(i, j) = WorksheetFunction.Index(Range("K" & i & ":" & "N" & i), WorksheetFunction.Rank(Range("P" & i), Range("P" & i & ":" & "S" & i)))
[B] If Application.WorksheetFunction.CountIfs(Range(Cells(2, j), Cells(i, j)), Cells(i, j), Range(Cells(2, j), Cells(i, j)), "<>" & "X") > 1 Then Exit For[/B]
Next
Next
Loop Until i > LastRow
End Sub
Last edited: