VBA Userform: Is it possible to predict/ suggest text in textbox?

TitusandNero

New Member
Joined
Mar 17, 2016
Messages
26
Hello (operating on Excel 2007),
Not sure if this can be done but thought I'd ask anyway. You know when your typing in to a cell on an excel spreadsheet it often 'suggests' text based on what has gone before - like predictive text. I'm trying to minimise user input errors in a userform textbox which asks them to type in the employer's name. I could create a dropdown list but there are potentially hundreds of employers so I was wondering if there was a way to make the textbook suggest the employer's name based on what they'd inputted before to help with consistency. Ultimately I'd like the end user to be able to pull off a report By Employer and I know what I'll end up with is several versions of one employer's name if I don't do something. The textbox is called 'tbEMP1' and it's saved in column H of an excel sheet named 'Data'. Any help would be much appreciated. Thank you.
icon7.png
 
Hello (operating on Excel 2007),
Not sure if this can be done but thought I'd ask anyway. You know when your typing in to a cell on an excel spreadsheet it often 'suggests' text based on what has gone before - like predictive text. I'm trying to minimise user input errors in a userform textbox which asks them to type in the employer's name. I could create a dropdown list but there are potentially hundreds of employers so I was wondering if there was a way to make the textbook suggest the employer's name based on what they'd inputted before to help with consistency. Ultimately I'd like the end user to be able to pull off a report By Employer and I know what I'll end up with is several versions of one employer's name if I don't do something. The textbox is called 'tbEMP1' and it's saved in column H of an excel sheet named 'Data'. Any help would be much appreciated. Thank you.
icon7.png

You would still have to have a reference of all the possibilities for VBA to refer to, since the computer cannot conjure up names out of thin air. You would need a macro that reads the user input as it occurs and simultaneously scans the reference index for matching characters. I am not sure that VBA has that degree of flexibility, language wise. An alternative would be to use a ListBox or ComboBox with a list of the most commonly used employer's names and an option to ignore if the target employer is not one of the listed ones, so that manual entry could then be made. It might save a little bit of time, but overall, you might do just as well if the user types all of the names in, so long as they are consistently formatted.
 
Last edited:
Upvote 0
Thank you, I imagined it might be a wishful thinking moment but I appreciate your suggestions. I will opt for the combobox to be on the safe side. Cheers :)
 
Upvote 0
Thank you, I imagined it might be a wishful thinking moment but I appreciate your suggestions. I will opt for the combobox to be on the safe side. Cheers :)

Well, you never know in these forums. Somebody might have tried it before and been successful by manipulating some of the methods and mixing in some worksheet functions. I am sometimes amazed at the results of some of the postings here. Very seldom do I say it can't be done anymore. I might say that there is no clear solution for it. It does not hurt to post your ideas and see if somebody can offer a solution.
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top