Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
? To Tom Ogilvy or others on VBA Listbox
Tom,
A week or two back you responded to a question on how to program a Listbox into the system. I have tried everything to make this work but have consistently gotten the message "The macro "...xls'!Box_Click' cannot be found." What am I doing wrong? The code you wrote is: ================================================== Private Sub Worksheet_SelectionChange(ByVal Target As Range) On Error Resume Next Me.ListBoxes.Delete On Error GoTo 0 If Target.Column = 1 Then With Worksheets(3).Shapes.AddFormControl(xlListBox, 100, _ ActiveCell.Top, 100, 150) .Name = "Listbox1" .ControlFormat.ListFillRange = "Sheet2!a1:a18" End With Me.ListBoxes("Listbox1").OnAction = "Box_Click" End If End Sub In a general module (no the module associated with the sheet) put in this code Sub Box_Click() Set lbox = ActiveSheet.ListBoxes(Application.Caller) sVal = lbox.List(lbox.ListIndex) ActiveCell.Value = sVal End Sub ================================================== = Thanks for any help you can give. Brad K. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Tom Ogilvy | Excel Programming | |||
Tom Ogilvy | Excel Programming | |||
Tom Ogilvy | Excel Programming | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming | |||
Is refreshing listbox rowsource in listbox click event possible? | Excel Programming |