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
Bookmarks