+ Reply to Thread
Results 1 to 2 of 2

List based on another list in userform

  1. #1
    Registered User
    Join Date
    07-10-2012
    Location
    Norge
    MS-Off Ver
    Excel 2010
    Posts
    10

    List based on another list in userform

    Hi all!
    I have a problem populating my second of two lists. My data is arranged somewhat like this:

    Sheet1 (Data) Sheet2 (Innmelding)

    Title1 Title1
    Title2 - grouped data
    Title3 - grouped data
    Title4 - grouped data
    (empty row) (I need this empty row for other parts of my program)
    Title2
    - grouped data (and so on)

    What i got so far almost works, but when i use the "ActiveSheet.Outline.ShowLevels RowLevels:=2" the Match function (which i thought was already executed) seems to crash the
    program. Got any idea why this does not work? Or another way of doing this?
    Thanks!


    Private Sub UserForm_Initialize()
    Sheets("Data").Select
    Sheets("Data").Activate
    Set rng = Range("X9", Range("X9").End(xlDown))
    EndList = Application.WorksheetFunction.CountA(rng) + 8
    Set rng1 = Range(Cells(9, 24), Cells(EndList, 24))
    ListBox1.RowSource = rng1.Address
    Sheets("Innmelding").Select
    Sheets("Innmelding").Activate
    End Sub

    Private Sub ListBox1_Click()
    Set rng = Range("A6", Range("A6").End(xlDown))
    lngPos = WorksheetFunction.Match(ListBox1.Value, rng, 0)
    StartList = lngPos + 7
    Set rng1 = Range(Cells(StartList, 1), Cells(StartList, 1).End(xlDown))
    ActiveSheet.Outline.ShowLevels RowLevels:=2
    EndList = Application.WorksheetFunction.CountA(rng1) + StartList - 1
    Set rng2 = Range(Cells(StartList, 1), Cells(EndList, 1))
    ListBox2.RowSource = rng2.Address
    End Sub

  2. #2
    Registered User
    Join Date
    07-10-2012
    Location
    Norge
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: List based on another list in userform

    The error i got was "Run time error '1004' Unable to get the match property of the worksheet-function class", think i managed to solve for this one, but now the "ActiveSheet.Outline.ShowLevels RowLevels:=2" is bugging, i get the " Runtime error 1004 showlevels method of outline class failed"
    any help would be great!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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