target.ArrayFind
Description
Description
Finds a value of an arbitrary type in a one dimensional array.
Syntax
Syntax
Function ArrayFind(ary, value)
Parameters
Parameters
one dimensional variant array ary - an array in which the search is to take place
variant value - the value to search for
Return value
Return value
integer - an index of the found value or -1 if the value was not found
Example
Sample code
Function AddRecords
Dim i, j, k, c, s, n, cc, cr, rt, lc, lz, acr(), m_cr
If IsArray(sw) Then
n = Ubound(sw
m_cr = 0
For k = 0 To n
s = sw(k)
cr = Trim(Mid(s, 60, 50)) '<- craft
If Target.ArrayFind(acr, cr) = -1 Then
ReDim Preserve acr(m_cr)
acr(m_cr) = cr
m_cr = m_cr + 1
End If
Next
See also