A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi,
Ubound(names)=4 (0/1/2/3/4) 5 items
UBound(smithNames)=1 (0/1) 2 items
it's correct
first item is
smithNames(0)="Ann Smith"
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi there,
I am running into some issues while using VBA its 'Filter' function in a one dimensional array. It seems that only the first element that matches the 'Match' value is returned and not the subsequent one's.
To given an example, when running the code below, the second debug call return '1' but it should return '2'
Function FilterAnArray()
Dim names As Variant
names = Array("Ann Smith", "Barry Jones", "John Smith", "Stephen Brown", "Wilfred Cross")
Debug.Print UBound(names)
Dim smithNames As Variant
smithNames = Filter(names, "Smith")
Debug.Print UBound(smithNames)
End Function
Version information e.t.c.
I am running Excel 2016, version 16.0.8730.2046 - 64-bit.
Any help with this issue is much appreciated!
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Hi,
Ubound(names)=4 (0/1/2/3/4) 5 items
UBound(smithNames)=1 (0/1) 2 items
it's correct
first item is
smithNames(0)="Ann Smith"