feloniouslemon
Technical User
Greetings,
This may be a fantastically stupid question. I was once an experienced VB programmer, but haven't coded for some time. I'm trying to write some VBA within an Excel workbook, and stumped by referencing some of the objects in the worksheet.
I can get to the workbook, worksheet, and cells. But I can't get to the listbox I've added to the worksheet.
So, for example:
Dim i as int
Dim wb as Workbook
Dim ws as Worksheet
Set wb = ThisWorkbook
Set ws = ThisWorkbook.ActiveSheet
i = ws.Cells(1,1)
This all works. But I have a listbox called lb, and I would like to get the value the user has selected from it, so "A" from a listbox showing A, B, C.
How do I dimension that variable, and set it to equal the listbox (lb) in the worksheet? I would expect to set it, and then have properties like .Value or something along those lines.
ANY help is greatly appreciated - I feel like I'm missing the obvious, but I just don't see it.
Cheers,
geek
This may be a fantastically stupid question. I was once an experienced VB programmer, but haven't coded for some time. I'm trying to write some VBA within an Excel workbook, and stumped by referencing some of the objects in the worksheet.
I can get to the workbook, worksheet, and cells. But I can't get to the listbox I've added to the worksheet.
So, for example:
Dim i as int
Dim wb as Workbook
Dim ws as Worksheet
Set wb = ThisWorkbook
Set ws = ThisWorkbook.ActiveSheet
i = ws.Cells(1,1)
This all works. But I have a listbox called lb, and I would like to get the value the user has selected from it, so "A" from a listbox showing A, B, C.
How do I dimension that variable, and set it to equal the listbox (lb) in the worksheet? I would expect to set it, and then have properties like .Value or something along those lines.
ANY help is greatly appreciated - I feel like I'm missing the obvious, but I just don't see it.
Cheers,
geek