Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Listindex problems in multicolumn listbox
I have a form button that toggles something on and off. The state is
kept in a cell which says "on" or "off". The second column of my two-column listbox indicates the state. The appropriate item in the second column is being updated when I click the toggle button. My problem is that, after the listbox is updated, I can't use listindex to cause the row that was selected to be solected again. If I comment out the "Call FillWorkbookListbox" line, everything is fine, but I need to make that call. After clicking the toggle button, the listbox is updated fine, but no row at all is selected, although if I keep clicking the toggle button, the appropriate item in the second column continues to toggle. What am I doing wrong? Private Sub Button_TogglexlStart_Click() Dim ConSht As Object Set ConSht = ThisWorkbook.Sheets("Controls") Dim showListIndex As Integer showListIndex = MainDialog.ListBox_Workbook.ListIndex If ConSht.Cells(showListIndex + 2, 3).FormulaR1C1 = "yes" Then ConSht.Cells(showListIndex + 2, 3).FormulaR1C1 = "no" Else ConSht.Cells(showListIndex + 2, 3).FormulaR1C1 = "yes" End If Call FillWorkbookListbox Call CreateFavoritesMenu MainDialog.ListBox_Workbook.ListIndex = showListIndex End Sub Sub FillWorkbookListbox() Dim ConSht As Object Set ConSht = ThisWorkbook.Sheets("Controls") dim lastRow as integer lastRow = ConSht.Range("A16384").End(xlUp).Row With MainDialog.ListBox_Workbook .RowSource = "[" & ThisWorkbook.Name & "]" & "Controls!" & "B2:C" & lastRow .ColumnHeads = True .ColumnCount = 2 .BoundColumn = 0 .ColumnWidths = "160;40" End With End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ListBox and ListIndex | Excel Programming | |||
listbox listindex problem | Excel Programming | |||
Multicolumn Listbox and ordinary listbox | Excel Programming | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming | |||
Values in a MultiColumn Listbox | Excel Programming |