Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Control Help

  Asked By: Daryl    Date: Mar 18    Category: MS Office    Views: 633
  

I am trying to link a control button to a table in my workbook. I want
to do this with either a listbox or option buttons. The problem is I'm
not so sure how to set this up and what code I need to put.

I am new to this site and new to the wonderful world of Excel VBA, so
any assistance would be appreciated.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Tyrell Thompson     Answered On: Mar 18

The quick and dirty method is to use the listbox  property called RowSource.
You are able to assign the address of your list to that property and the
listbox will list the values in your table. The only downside is that if
the dimensions of the list change you have to remember to go update the
RowSource property.

The not as quick version is to use the worksheet or userform's activate
event to loop through your list and use the AddItem method of the listbox to
add all the items in the table. As long as the loop is dynamic, the list
will always display the values in your table  even if the number of rows
change.

There are other options, but these two should get you what you need.

 
Didn't find what you were looking for? Find more on Control Help Or get search suggestion and latest updates.




Tagged: