Len Piwowar
11-30-2004, 05:55 AM
Is there a way to return an interger representing the selected value row in a ActiveX embedded listbox?
I know it can be done using a forms listbox but, the activeX embedded Listbox works differently when selecting a value in a listbox Listbox.index does not return an indexed interger. The Listbox selected value returns only the selected .text / .value and not a Indexed number.
I embedded a Listbox from the contols toolbar because I wanted the Listbox to allways stay in the same position on the sheet without the overhead of writting code to position it. Values are loaded from the worksheet depending on which cell is selected. The fill values change by changing the range name for ListFillRange = RpsListBxSettings(1). I have a need to return a a Indexed Interger value.
Sub SetRpsListBox(RpsListBxSettings)
Application.ScreenUpdating = True
Application.ActiveWorkbook.Worksheets("Rps").Activate
Application.ActiveWorkbook.Worksheets("Rps").RpsListBox.ListFillRange = RpsListBxSettings(1)
Application.ActiveWorkbook.Worksheets("Rps").RpsListBox.ColumnCount = RpsListBxSettings(2)
Application.ActiveWorkbook.Worksheets("Rps").RpsListBox.TextColumn = RpsListBxSettings(3)
Application.ActiveWorkbook.Worksheets("Rps").RpsListBox.ColumnWidths = RpsListBxSettings(4)
End Sub
I know it can be done using a forms listbox but, the activeX embedded Listbox works differently when selecting a value in a listbox Listbox.index does not return an indexed interger. The Listbox selected value returns only the selected .text / .value and not a Indexed number.
I embedded a Listbox from the contols toolbar because I wanted the Listbox to allways stay in the same position on the sheet without the overhead of writting code to position it. Values are loaded from the worksheet depending on which cell is selected. The fill values change by changing the range name for ListFillRange = RpsListBxSettings(1). I have a need to return a a Indexed Interger value.
Sub SetRpsListBox(RpsListBxSettings)
Application.ScreenUpdating = True
Application.ActiveWorkbook.Worksheets("Rps").Activate
Application.ActiveWorkbook.Worksheets("Rps").RpsListBox.ListFillRange = RpsListBxSettings(1)
Application.ActiveWorkbook.Worksheets("Rps").RpsListBox.ColumnCount = RpsListBxSettings(2)
Application.ActiveWorkbook.Worksheets("Rps").RpsListBox.TextColumn = RpsListBxSettings(3)
Application.ActiveWorkbook.Worksheets("Rps").RpsListBox.ColumnWidths = RpsListBxSettings(4)
End Sub