I need to setup a dynamic range based on another dynamic range. I also need to make the code universal so I can plug it easily into other worksheets.
Previously I used the following code, which is static & relies on the concentate of 3 user defined values.
conc = dyear & admit_type & geo_zip
Set Arrays = ActiveWorkbook.Sheets("Arrays")
data_array = Application.WorksheetFunction.VLookup(conc, Arrays.Range("A1:E523"), 5, False)
I am looking to do something more like this (this code looks at a range of numbers for matches and returns all names with that number), but instead of returning the values for a dropdown list I need the dynamic range setup (i.e. not values but cell references). This range will then be used in a lookup to provide the actual range value for another vlookup.
With wksht
With .Range("A2", .Cells(Rows.Count, 1).End(xlUp))
Set r = .Find(What:=iopcert, LookAt:=xlWhole)
If Not r Is Nothing Then
sAdr = r.Address
Do
Me.HospSelect.AddItem r(1, 2).Value
Set r = .FindNext(r)
Loop While r.Address <> sAdr
End If
End With
End With
It will use the attached ArrayList worksheet. Based on the ADMIT TYPE it will collect the range of all the TRAUMA, or STANDARD etc to then be used in another Vlookup based on the GEOZIP to return the ARRAY value.
I realize I may be confusing some terms like array & range in my usage. Please forgive the Newb.
Bookmarks