Epsilon101
Programmer
Code:
-----------------------------------------------------------
Text to add: |_________________________________|
0 Option 1(Titles) To List
0 Option 2 |Add| -------------- |Cancel|
0 Option 3 |Delete| | Mr | |Ok|
0 Option 4 | Mrs |
| Dr |
| etc... |
| |
---------------
-----------------------------------------------------------
Hi this is the design of the userform i have got in excel, i wanted to ask if someone has done something similar before cos i am having some trouble.
I want to let people add information to a list of data or delete it, but through this form rather than on the worksheet.
The idea is that i have 4 worksheets with data in column A.
As an example 1 sheet is called Titles.
In the form above, it opens up with the option button 1 (Titles) selected, i want to have the information on the Titles Sheet column A display in the listbox, it wont have blank cells inbetween the data as the sheet is not being used.
If someone chooses a different option button, the listbox data needs to change to data in another worksheet column A that is relevant to the button. So it will display 4 listboxes at different times in the 1 listbox.
When the user has a listbox selected, i want them to type in text into the textbox at the top and click the ADD button, it will then be added to the listbox. They can also select an item from the listbox and Delete it have no spaces remaining.
Ok button will be to keep the changes and Cancel not keep the changes.
I have used a listbox with option buttons before where the rowsource is changed in vba but this time i am using data on a worksheet, so i am not sure how to get the info.
Maybe a variable: Worksheets("Titles").Cells.SpecialCell(xlCellTypeLastCell).Row, which would be the last row and then a loop.
I was thinking for the add button to do .additem and doing a loop and do .AddItem Worksheets("Titles").Cells(Row, 1)
So it runs through each row and adds it to the listbox as you click the option button.
The Cancel button is really stumping me because dont know if you can just undo everything since the userform was opened.
The whole point of this form is as maintenance.
I have another userform that uses combo boxes, this form is to let users maintain the selections in those combo boxes.
Any help would be great
---------------------------------------
Neil