Fair enough, but all we have to test with and comment on is what you actually give us - & we are trying to help.because i didn't copy the entire code as thats not allowed
"didn't want to play" is very vagueI tried the 1 liner but it didnt want to play
nemmi69.xlsm | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | ||||||
2 | Unit | Action | ||||
3 | 2 | Initial | ||||
4 | 4 | Replacement | ||||
5 | 3 | Initial | ||||
6 | 4 | Replacement | ||||
7 | 1 | Repair | ||||
8 | ||||||
Sheet1 |
Sub Test()
Dim TblId As ListObject
Dim TblHdr As String
Set TblId = ActiveSheet.ListObjects(1)
Dim LArr As Variant
TblHdr = "Action"
LArr = Evaluate("sort(unique(" & TblId.Name & "[" & TblHdr & "]))")
End Sub
.. which is exactly what my code does, isn't it?Ah, I am trying to gather the unique elements into an array for use with a report macro
Sub Test()
Dim TblId As ListObject
Dim TblHdr As String
Dim LArr As Variant
Set TblId = ActiveSheet.ListObjects(1) '<- Set to your particular ListObject/Table
TblHdr = "Action" '<- Set to your particular table heading
LArr = Application.Transpose(Evaluate("sort(unique(" & TblId.Name & "[" & TblHdr & "]))"))
End Sub