How to get unique record using vba array.

Published: 12 May 2020
on channel: VBA Learning tutorials
2,069
31

How to get unique record using vba array.

Sub GetUniqueNameUsingArray()

Dim rng As Variant

Dim i As Integer

Dim lrow As Integer

Dim arr As Variant

ReDim rng(1 To Sheet1.Range("A1").CurrentRegion.Rows.Count) As Variant

arr = Sheet1.Range("A1").CurrentRegion.Value

lrow = 2

For i = LBound(rng, 1) To UBound(rng, 1)

If WorksheetFunction.CountIf(Sheet1.Range("A1:A" & i), arr(i, 1)) = 1 Then

Sheet1.Range("B" & lrow).Value = arr(i, 1)
lrow = lrow + 1
End If
Next i

End Sub


On this page of the site you can watch the video online How to get unique record using vba array. with a duration of hours minute second in good quality, which was uploaded by the user VBA Learning tutorials 12 May 2020, share the link with friends and acquaintances, this video has already been watched 2,069 times on youtube and it was liked by 31 viewers. Enjoy your viewing!