Hi guys, I have an array of unknown size (at least 100x 85) , filled with alphanumeric characters and blank cells - basically around 100 lists of vaying lengths. I need to have a way to remove the duplicate cells from across all the lists, leaving only the unique values. And also get rid of the blank cells intermixed - optional. My thought process was to use nested loops to compare the A1 against every cell in array and delete if equal and move on if different, then start back at A2 and proceed on and on. This seems like the simplest solution to me, but I am not well versed in Excel, so I'm having a little difficulty. Here's my code so far, it compiles but does nothing lol
Option Explicit
Sub test()
Dim varSheetA As Variant
Dim strRangeToCheck As String
Dim iRow As Long
Dim iCol As Long
Dim iRows As Long
Dim iCols As Long
Dim iCole As Long
' Dim iRowe As Long
' Dim iRowes As Long
' Dim iColes As Long
'Range("A1:DD100").SpecialCells(xlCellTypeBlanks) = "Blank" 'Delete blanks -> sort by by "Blank and delete
strRangeToCheck = "A1:DD100"
varSheetA = Worksheets("Sheet1").Range(strRangeToCheck)
For iRows = LBound(varSheetA, 1) To UBound(varSheetA, 1)
' iRowes = iRows + 1
For iCols = LBound(varSheetA, 2) To UBound(varSheetA, 2)
' iCole = iCols + 1
For iRow = LBound(varSheetA, 1) To UBound(varSheetA, 1)
' iRowe = iRow + 1
For iCol = LBound(varSheetA, 2) To UBound(varSheetA, 2)
iCole = iCol + 1
If iCole < 100 Then
If varSheetA(iRows, iCols) = varSheetA(iRow, iCole) Then ' Cells are identical.
varSheetA(iRow, iCole) = " "
Else ' Cells are different.
End If
End If
Next iCol
Next iRow
Next iCols
Next iRows
End Sub
Bookmarks