Fill combobox from specified range
I have a userform (userform1), with a combobox (combobox1) on it. When
start the userform from a sheet, the combobox should be filled with dat from range A&:A200 in the same sheet. No dublicates should be added. I have tried with the '.....userform1_initialize()', but nothing seem to happen. Can somebody give me the correct code. Thnks -- Message posted from http://www.ExcelForum.com |
Fill combobox from specified range
|
Fill combobox from specified range
|
Fill combobox from specified range
Private Sub UserForm_Initialize()
Dim num As Integer Dim CellText Dim Search num = 6 Do CellText = Range("A" & num).Value Set Search = Range("A5:A" & num - 1).Find(CellText LookIn:=xlValues) 'searches to see whether the text has shown up prior to curren position 'if it's not found, it returns 'Nothing' If Search Is Nothing Then ComboBox1.AddItem CellText End If num = num + 1 Loop Until num = 200 ' Range("a" & num).Value = "" <<Use if you wan it to go until the cell is blank End Sub -Gitcyphe -- Message posted from http://www.ExcelForum.com |
Fill combobox from specified range
|
All times are GMT +1. The time now is 04:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com