I need to remove reverse duplicates from the array.
From 1,2 and 2,1 I want to remove 2,1 since it's reverse is a duplicate for 1,2.
Sub go()
Dim arr() As String
ReDim Preserve arr(0)
Dim i, k As Integer
For i = 1 To 2
For k = 1 To 10
If i <> k Then
arr(UBound(arr)) = i & "," & k
ReDim Preserve arr(UBound(arr) + 1)
End If
Next
Next
'Debug.Print Join(arr, vbCrLf)
For z = 0 To UBound(arr)
For q = 0 To UBound(arr)
rev = StrReverse(arr(z))
If arr(q) = rev Then
Debug.Print arr(z) & "-" & rev
End If
Next
Next
End Sub
Dim i, k As Integer. What you actually have declared here isDim i As Variant, k As Integer. VB6 & VBA don't support declaring multiple variables as a certain data type in one statement. If you want to declare both asInteger, the declaration needs to look likeDim i As Integer, k As Integer.