Temporary-Failure
Board Regular
- Joined
- Jul 16, 2010
- Messages
- 140
I use code below. But from some reason following strings makes empty result. What's wrong?
Y-column strings:
sku=PFF12-201+powerflex=PFF12-201|sku=PFF12-201+powerflex=PFF12-201
sku=PFF19-601+powerflex=PFF19-601|sku=PFF19-602+powerflex=PFF19-602|sku=PFF19-901+powerflex=PFF19-901|sku=PFF19-601+powerflex=PFF19-601|sku=PFF19-602+powerflex=PFF19-602|sku=PFF19-901+powerflex=PFF19-901
Y-column strings:
sku=PFF12-201+powerflex=PFF12-201|sku=PFF12-201+powerflex=PFF12-201
sku=PFF19-601+powerflex=PFF19-601|sku=PFF19-602+powerflex=PFF19-602|sku=PFF19-901+powerflex=PFF19-901|sku=PFF19-601+powerflex=PFF19-601|sku=PFF19-602+powerflex=PFF19-602|sku=PFF19-901+powerflex=PFF19-901
VBA Code:
Sub Test()
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Dim arr1, arr2
rivi = 2
Do Until Range("A" & rivi).Value = ""
arr1 = Split(Range("Y" & rivi).Value, "|")
arr2 = RemoveDupes(arr1)
'Debug.Print Join(arr2, vbLf)
Range("AD" & rivi).Value = Join(arr2, "|")
rivi = rivi + 1
Loop
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End Sub
Function RemoveDupes(InputArray) As Variant
Dim Array_2()
Dim eleArr_1 As Variant
Dim x As Integer
x = 0
On Error Resume Next
For Each eleArr_1 In InputArray
If UBound(Filter(InputArray, eleArr_1)) = 0 Then
ReDim Preserve Array_2(x)
Array_2(x) = eleArr_1
x = x + 1
End If
Next
RemoveDupes = Array_2
End Function