Bạn dùng công thức thì đúng thế.
Nếu bạn chạy sub test sau thì OK.
Tôi cũng nghĩ thế. Và xin mời tham khảo code sửa như sau:
[GPECODE=vb]
Public Function UniqueArray(ParamArray Source())
Dim SourceItem, SubItem, TmpArr
Dim Dict As Object, Tmp
Set Dict = CreateObject("Scripting.Dictionary")
For Each SourceItem In Source
Tmp = SourceItem
If Not IsArray(Tmp) Then Tmp = Array(Tmp)
For Each SubItem In Tmp
If Not IsEmpty(SubItem) And Not Dict.Exists(SubItem) Then
Dict.Add SubItem, ""
End If
Next
Next
UniqueArray = Application.WorksheetFunction.Transpose(Dict.Keys)
Set Dict = Nothing
End Function
Sub Bup()
Dim arr
arr = UniqueArray([D5:I17], [L8:L11], [D21

36])
Range("L13").Resize(UBound(arr)).Value = arr
End Sub
[/GPECODE]