Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ListBox and ListIndex mtm4300 via OfficeKB.com Excel Programming 2 April 5th 06 05:56 PM
listbox listindex problem jacob Excel Programming 2 August 25th 04 08:46 AM
Multicolumn Listbox and ordinary listbox Ron_D Excel Programming 0 June 4th 04 08:56 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Values in a MultiColumn Listbox Tom Ogilvy Excel Programming 5 September 5th 03 08:30 PM


All times are GMT +1. The time now is 04:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"