Results 1 to 6 of 6

Setting up Dynamic Ranges from Cells (Excel 14, VBA Only)

Threaded View

  1. #1
    Forum Contributor
    Join Date
    03-22-2012
    Location
    OR, USA
    MS-Off Ver
    Excel 14/2010
    Posts
    273

    Setting up Dynamic Ranges from Cells (Excel 14, VBA Only)

    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.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1