Darren Bartrup
Well-known Member
- Joined
- Mar 13, 2006
- Messages
- 1,296
- Office Version
- 365
- Platform
- Windows
I have an array set up called arrData(1 to 16, 1 to 393). The second element of the array is variable - usually between 100 and 500.
The array contents are in this format:
with elements 4 to 16 being empty.
What I'm trying to do with the code above is to return the ID number from the worksheet and find where it is in the array, hopefully without having to search through the array one element at a time.
So if wrkSht.Cells(iCntr3,2) held 100078591, then C (in the above code) would return 3 - i.e. arrData(1,3).
How do I do this? I pretty much knew the code above wouldn't work, but it was worth a try
The array contents are in this format:
- arrdata(1,1) : 100075503 : Variant/Double
arrdata(1,2) : 100075610 : Variant/Double
arrdata(1,3) : 100078591 : Variant/Double
arrdata(2,1) : "Fred Smith" : Variant/String
arrdata(2,2) : "Tom Jones" : Variant/String
arrdata(2,3) : "Eric Clapton" : Variant/String
arrdata(3,1) : "Ld Team-Basildon" : Variant/String
arrdata(3,2) : "Ld Team-Basildon" : Variant/String
arrdata(3,7) : "Ld A&T-Colchester" : Variant/String
with elements 4 to 16 being empty.
Code:
Select Case wrkSht.Name
Case "1.a"
For iCntr3 = iFirstTeamRow To iLastTeamRow
Set c = arrdata(1) _
.Find(wrkSht.Cells(iCntr3, 2), LookIn:=xlValues)
Next iCntr3
End Select
What I'm trying to do with the code above is to return the ID number from the worksheet and find where it is in the array, hopefully without having to search through the array one element at a time.
So if wrkSht.Cells(iCntr3,2) held 100078591, then C (in the above code) would return 3 - i.e. arrData(1,3).
How do I do this? I pretty much knew the code above wouldn't work, but it was worth a try