ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combobox - add manual entry to future list (https://www.excelbanter.com/excel-programming/288150-combobox-add-manual-entry-future-list.html)

cornishbloke[_23_]

Combobox - add manual entry to future list
 
Another query,

When a user enters a manual entry into the combobox on my userform
want the userform to ask if this entry should be added to the drop-dow
list for future use.

I can manage most of this but I don't know what the statement would b
for determining if the manual entry is in the existing list or not.

if combobox1.value = 'one not in source list' then
call userform2 etc

Can anyone help

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Combobox - add manual entry to future list
 
Same as any other type of comparison. You would loop through the list and
see if the value of the combobox matches any entry in the list. There is
not built in setting or attribute that will tell you that information.

You can also avoid a loop by using the worksheet Match function.

--
Regards,
Tom Ogilvy

"cornishbloke " wrote in
message ...
Another query,

When a user enters a manual entry into the combobox on my userform I
want the userform to ask if this entry should be added to the drop-down
list for future use.

I can manage most of this but I don't know what the statement would be
for determining if the manual entry is in the existing list or not.

if combobox1.value = 'one not in source list' then
call userform2 etc

Can anyone help?


---
Message posted from http://www.ExcelForum.com/




cornishbloke[_24_]

Combobox - add manual entry to future list
 
Hi Tom,

This would be the first time that I've needed to use a loop, so I'm not
sure how to do what you suggest. Assuming my list is in cells A1:A10
and is named "ContList" how would I use loop through to check if the
value of ContCombobox matches any in this range?

Thank you for your patience!


---
Message posted from http://www.ExcelForum.com/


Tom Ogilvy

Combobox - add manual entry to future list
 
Dim cell as range
Dim bMatch as boolean
Dim ans as Variant
for each cell in Range("ContList")
if lcase(trim(cell.value) = me.Combobox1.Value then _
bMatch = True
exit for ' found, no need to continue checking
End if
Next
if not bMatch then
ans = msgbox( "Add " & me.Combobox1.Value & " to list?", vbYesNo)
if ans = vbYes then
' add to list
end if
End if

--
Regards,
Tom Ogilvy

"cornishbloke " wrote in
message ...
Hi Tom,

This would be the first time that I've needed to use a loop, so I'm not
sure how to do what you suggest. Assuming my list is in cells A1:A10
and is named "ContList" how would I use loop through to check if the
value of ContCombobox matches any in this range?

Thank you for your patience!


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 07:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com