arrays and finding unique names in a list
The program I am trying to write is trying to compare two lists of arrays and see if they have the name. If they do not have the name then I need to add it to a list and at the end of the program i print the list. Right now I have written my program but it keeps saying my subscript is out of range and I do not now how to better the code.
Function findUniques(astrArray1() As String, astrArray2() As String) As String
Dim lngnumber As Long
Dim lngnumbertwo As Long
Dim struniquenames As String
lngnumbertwo = 1
Dim strnewarray(1 To 1000)
Do Until astrArray1(lngnumber) = ""
Call isPresent(astrArray2(), astrArray1(lngnumber))
If isPresent(astrArray2(), astrArray1(lngnumber)) = True Then
lngnumber = lngnumber + 1
Else
strnewarray(lngnumbertwo) = astrArray1(lngnumber)
lngnumbertwo = lngnumbertwo + 1
lngnumber = lngnumber + 1
End If
Loop
lngnumbertwo = 1
Do Until strnewarray(lngnumbertwo) = ""
struniquenames = struniquenames & strnewarray(lngnumbertwo) & ", "
Loop
Debug.Print struniquenames
End Function
this is my code as follows and the is present function was a function written by the professor to figure out if the name is present in the two lists. I have also attached my file for you to look at as well. Please let me know how I can fix this and make my program work.
Thank you
Attachment | Size |
---|---|
CS105-2013-Spring-MP5-1.0.1 (1).xlsm | 23.44 KB |
Recent comments
5 years 34 weeks ago
6 years 20 weeks ago
6 years 32 weeks ago
6 years 35 weeks ago
6 years 36 weeks ago
6 years 42 weeks ago
6 years 50 weeks ago
6 years 50 weeks ago
6 years 50 weeks ago
6 years 50 weeks ago