I have a Listbox on my Primary worksheet that displays all the Named Ranges from my secondary worksheet. I want the user to be able to click on one of the items in the listbox and have the system select the named range and do a preview. At this one, I can't even figure out how to get the Listbox to select the named range when I click it. Please Help!
Excel 2007 Help with Listbox OnClick Code
Collapse
X
-
I'll assume you're working on Excel's VBA. Simply, in the VBA code area; Go to your Project Window, expand the workbook's project, double clic the worksheet you want to triger the event.
In the upper left menu of the code area, select Worksheet instead of General. Then in the upper right menu of the code area, select the event you want to handle (perhaps 'Selection Change'), and write your code there, something like:
HTHCode:Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Row = 1 And Target.Column = 1 Then MsgBox ("Selected row is A1") End Sub
Comment