Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populating Userform and then using selected data.
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populating Userform and then using selected data.
On Aug 13, 1:16*pm, AUCP03 wrote:
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 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Populating dropdown list 2 with data depending upon what was selected in list 1 | Excel Programming | |||
Populating data on userform | Excel Programming | |||
Populating Sheet Data From A UserForm Combo Box Enabled For Multi-Choices | Excel Programming | |||
Populating a VBA UserForm | Excel Programming | |||
Populating Textbox in UserForm | Excel Programming |