Senipah / VBA-Better-Array

An array class for VBA providing features found in more modern languages
MIT License
115 stars 18 forks source link

[BUG] #26

Open fshhady opened 6 hours ago

fshhady commented 6 hours ago

Describe the bug if get array from range the Includes() function is not seem to work.

To Reproduce Steps to reproduce the behavior: Public Sub Test() Dim arrBA As New BetterArray '---------------------- arrBA.FromExcelRange Sheet1.Range("G7:I10") Debug.Print arrBA.Includes(3) End Sub

Expected behavior exprected result is true if the range contains the value 3, but the result is always false.

Screenshots image

Operating System:

Host Application:

ws-garcia commented 4 hours ago

An eye bird view make me think that there is an error/typo in your range definition. Actually Sheet1.Range("G7:I10") doesn't content the value you are trying to find. Your data range, looking at the image and the provided code, is Sheet1.Range("G1:I4"). Fix it for record and wait author response.

Edit:

Given that your array isn't one-dimensional, your code needs to use recursion.

Try arrBA.Includes(3, recurse:=True)