Results 1 to 4 of 4

Populating Listbox in a Userform with a named range from another sheet

Threaded View

  1. #1
    Registered User
    Join Date
    11-05-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    15

    Populating Listbox in a Userform with a named range from another sheet

    Hello All and thank you for any help you may be able to offer in advance. The code I've placed below is called from a macro on a different sheet (Framing Tool) and is meant to first determine the size of a list, make that list into a range, and then place the range as the options in a listbox. However the code is creating the range from the current sheet rather than WsOppDB and I cannot figure out why, any thoughts?

    Also, I'm having trouble understanding the difference between .list and .rowsource.

    Private Sub UserForm_Initialize()
    
    Dim wsOppDB, wsframingtool As Worksheet
    Dim OpprangeList As Range
    Dim opprangenumber As Integer
    
    Set wsOppDB = Sheets("OpportunitiesDB")
    Set wsframingtool = Sheets("Framing Tool")
    
    opprangenumber = Application.WorksheetFunction.CountA(wsOppDB.Range("C11:C500"))
    
    With wsOppDB
    Set OpprangeList = Range(Cells(11, 3), Cells(11 + opprangenumber - 1, 3))
    End With
    
    With OpportunityList
        .List = OpprangeList.Value
    End With
    'MsgBox opprangenumber
    End Sub
    Last edited by gruberm; 04-02-2013 at 06:49 AM.

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