Article ID: 140034
Article Last Modified on 10/11/2006
Sub Test()
Dim Lbox As Object
' Create the Lbox object, which will be the list box on the Active
' sheet.
' Activesheet can be changed to sheets("test") where test is the
' name of the sheet on which you want the information.
Set Lbox = ActiveSheet.ListBoxes(1)
' Check to see the value (or what is selected) of the list box. If
' zero, exit the Sub.
If Lbox.Value = 0 Then Exit Sub
' Change the value of the Active cell to be what is selected in the
' list box
ActiveCell.Value = Lbox.List(Lbox.Value)
' Set the list box back to zero or nothing selected.
Lbox.Value = 0
End Sub
To assign the macro to the list box control, follow these steps:
Additional query words: XL98 XL97 XL7 XL5 listbox
Keywords: kbdtacode kbhowto kbprogramming KB140034