Populating Userform and then using selected data.

A

AUCP03

I have a worksheet called Listing. There will be more/less WS as people
move around, but lets call these sheets Tom, Bob, and Jim.

WS Listing has 12 columns with headers. Not all the cells are filled in all
the columns. The headers start in 3A and the data starts in 4A. All of it
is in a list.

The WS Tom, Bob, and Jim are all the same format so I will describe only WS
Tom
WS Tom uses five columns starting in A8.

WS Tom has a command button which starts a macro to start a userform. The
user form is a multiselect Listbox. I need the userform to go to WS Listing
and pull columns A-E and H-I starting in row 4 and going until there are no
more entrees in row E or I (these columns will both always have an entree if
the row is used). Also it needs to clear itself everytime before it reloads
the list so that it will get the most current inventory.

The same userform has a command button. After the user selects all the
desired items they will click this to run another macro I would assume. I
would like it to copy the selcted items in columns A,B,E,H,I from WS Listing
and the WS title of the WS it is selected from (in this case Tom) to WS
Pending starting in A7 (the headers start in A6).

I have been trying with the help functions, but I have only been able to get
the command button to pull up the userform and put some of the information in
it. I am not good at this by any means so please speak slowly. Thank you in
advance for any help.

Regards,
AUCP03
 
M

Matthew Herbert

I have a worksheet called  Listing.  There will be more/less WS as people
move around, but lets call these sheets Tom, Bob, and Jim.

WS Listing has 12 columns with headers.  Not all the cells are filled in all
the columns.  The headers start in 3A and the data starts in 4A.  Allof it
is in a list.

The WS Tom, Bob, and Jim are all the same format so I will describe only WS
Tom
WS Tom uses five columns starting in A8.

WS Tom has a command button which starts a macro to start a userform.  The
user form is a multiselect Listbox.  I need the userform to go to WS Listing
and pull columns A-E and H-I starting in row 4 and going until there are no
more entrees in row E or I (these columns will both always have an entreeif
the row is used).  Also it needs to clear itself everytime before it reloads
the list so that it will get the most current inventory.

The same userform has a command button.  After the user selects all the
desired items they will click this to run another macro I would assume.  I
would like it to copy the selcted items in columns A,B,E,H,I from WS Listing
and the WS title of the WS it is selected from (in this case Tom) to WS
Pending starting in A7 (the headers start in A6).

I have been trying with the help functions, but I have only been able to get
the command button to pull up the userform and put some of the information in
it.  I am not good at this by any means so please speak slowly.  Thank you in
advance for any help.

Regards,
AUCP03

AUCP03,

Do you have any code to post? In general a ListBox can be filled with
AddItem and/or RowSource (and I'm sure there are other ways too). You
can remove items via Clear/RemoveItem or by unloading the form (i.e.
Unload Me -- Me equals the referenced class, in this case the parent
user form. So, if your user form is named UserForm1 and you have code
behind this user form, then Me is equivalent to UserForm1). After
your list box is filled, you can then loop through the items with a
For loop (the ListCount property will tell you how many items are in
your list box), or you can reference the selected item through the
Selected property. Look at some of these methods and properties to
see if this gets you pointed in the right direction.

As an aside, if you are curious in how to see what methods and
properties are available you can do at least two things after you add
a user form in the VBE (1) in a code module, type the user form name,
a ".", the list box name, and then a ".". Once you enter the second
"." the Intellisense will popup, showing the methods and properties
(2) open the object browser (View | Object Browser; or simply, F2),
search by the userform name (which will appear in the "Classes" list),
and view the "Members". (Methods have the 3D, slanted box that seems
to be moving to the right and properties have the icon that looks like
a hand holding a card )

Best,

Matthew Herbert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top