Re: Simple Array Script help
you want to check if one serial number, input by user, is in the array?
Re: Simple Array Script help
Yes, within all those arrays
Re: Simple Array Script help
you can try like this to see if it suits your needs
Code:
salga = Array("0301/4535/0000", "0550/4535/0000") 'Salga
sec = Array("0301/4213/0000", "0550/4213/0000", "0700/4213/0000")
tarw = Array("0101/4515/0000", "0401/4515/0000") 'Target Women
tary = Array("0003/4517/0000", "0401/4517/0000") 'Target Youth
train = Array("0211/4523/0000", "0501/4523/0000") 'Training
ReDim myarr(4) ' change to suit if more arrays are used
myarr(0) = salga
myarr(1) = sec
myarr(2) = tarw
myarr(3) = tary
myarr(4) = train
spec = InputBox("enter value", "Serial No", "0101/4515/0000")
For i = 0 To UBound(myarr)
For j = 0 To UBound(myarr(i))
If myarr(i)(j) = spec Then fnd = True: Exit For
Next
If fnd Then Exit For
Next
If fnd Then
MsgBox "The current vote you created is allocated on Vehicle."
Else
MsgBox "Vote Number Not found", vbCritical, "WARNING"
End If
Re: Simple Array Script help
Now that is what i was trying to accomplish :D. Thank you for that. Now i just need to create a script to justify exactly which array was located within this input box.
Once again, thank you
Re: Simple Array Script help
try like
Code:
salga = Array("0301/4535/0000", "0550/4535/0000") 'Salga
sec = Array("0301/4213/0000", "0550/4213/0000", "0700/4213/0000")
tarw = Array("0101/4515/0000", "0401/4515/0000") 'Target Women
tary = Array("0003/4517/0000", "0401/4517/0000") 'Target Youth
train = Array("0211/4523/0000", "0501/4523/0000") 'Training
ReDim myarr(4) ' change to suit if more arrays are used
redim alist(4)
myarr(0) = salga: alist(0) = "salga"
myarr(1) = sec: alist(1) = "sec"
myarr(2) = tarw: alist(2) = "tarw"
myarr(3) = tary: alist(3) = "tary"
myarr(4) = train: alist(4) = "train"
spec = InputBox("enter value", "Serial No", "0101/4515/0000")
For i = 0 To UBound(myarr)
For j = 0 To UBound(myarr(i))
If myarr(i)(j) = spec Then fnd = True: location = alist(i): Exit For
Next
If fnd Then Exit For
Next
If fnd Then
MsgBox "The current vote you created is allocated on Vehicle. at " & location
Else
MsgBox "Vote Number Not found", vbCritical, "WARNING"
End If