...a continuation from this thread.
In summary, it seems the .list property (and variants, such as .listindex) don't like it when the "list" is only a single value. So in the linked thread above, I solved my dependence on a named dynamic range in my workbook by using code to name my range, and counting the rows of the range... if rows count = 1 (which will causes an error in the .list property), then do <this> action, but if rows count > 1, then we can use .list.
So I have an employee list in ws("Admin Menu") in column B. Column A contains a record number (1, 2, 3...) of the number of employees. The list begins on row 2 underneath a header row, and $B$2 is always "Former Employee." In my named dynamic range, the range begins on $B$3. I have a userform to delete an employee. It populates a combo box with a list of the employees, and once one is selected, first finds all matching employees in the worksheet("Data") and changes that employee's names to "Former Employee" - this way data associated with that employee is kept, but records for that employee name are not - and then deletes the employees name from the list on the ws("Admin Menu"). Here's my code:
![]()
Please Login or Register to view this content.
I would like to change my routine for the DelEmp_Click() by NOT using the named range "EmpDelList" and instead naming the range with the VBA code used in the initialization (I am keeping the "EmpNameData" range - at least for now)... but the listindex property keeps tripping me up. Any help?
Again, sorry for not being able to upload a sample file at this time!!
-HeyInKy
Bookmarks