I am using Microsoft 365 Excel. In VBA, WorksheetFunction.Index(arr, rows, 1) doesn't work while Application.Index(arr, rows, 1) works, however, WorksheetFunction.Index(arr, 1, columns) works fine, where columns and rows are arrays.
I am working on these operations with WorksheetFunction.TextJoin(...).
(1) array of rows: working - resulting delimiter separated list where rows are row positions of arr:
result = WorksheetFunction.TextJoin(Delimiter, True, Application.Index(arr, rows, 1))
'' Not Working - resulting 0 where I expect a delimiter separated list:
result = WorksheetFunction.TextJoin(Delimiter, True, WorksheetFunction.Index(arr, rows, 1))
WorksheetFunction.Index(arr, rows, 1) in the code above results in nothing while Application.Index(arr, rows, 1) results in an array of rows-indicated values in arr.
(2) array of columns: working
result = WorksheetFunction.TextJoin(Delimiter, True, WorksheetFunction.Index(arr, 1, columns))
I am looking for a consistent and robust solution and technical explanations if possible. What's the clear distinction among these 3 approaches, Application.Index(), WorksheetFunction.Index(), and Applicaiton.WorksheetFunction.Index()? WorksheetFunction.Index(Arr, rows, 1) doesn't work but WorksheetFunction.Index(Arr, 1, columns) works fine in the VBA. Why? For consistency and robustness, should I keep Application.Index() approach? Is this the choice of Microsoft? Are there any technical documents related to this matter? I appreciate any technical comments.