Ok guys, I've come to you with another annoying (for me anyway!) Excel VBA combo box problem. First of all, this is just something I am doing for fun, I have no professional programming experience so excuse my ignorance. I have a user form with a combo box on it which I use the RowSource property to populate. It works as long as what I want is in the list. If I want to add something to it though, how do I do that? For example, I have apples and oranges in the list and want to add pears. Right now, I have a command button that I want to use to add the item to the list if needed. I know I can programmatically insert a cell or go to end of my list and write the value there, but I don't want to have duplicate items in the list. How can I search through a range of cells that is always changing (like A2:A5, next time might be A2:A6 as things get added)? I think I need to use some kind of loop, but I am not sure. Also, if I reference A:A for my RowSource property there are multiple blank rows in the combo box that I don't want. Would I then have to count the non-blank cells in A and change the RowSource property each time? Does this make sense?
Start Free Trial