Excel 2016 VBA Code for search box with multiple options and listbox to display results

Windy borough

New Member
Joined
Nov 3, 2018
Messages
35
This is a tricky one. I had lot of help in making a userform and I appreciate it. I had to redesign this userform to include multipage tab and list box to use search and edit function.
I managed to redesign and then had it working like older simpler userform but the search functionality is something that I know nothing about. I added save print options to the form and they are working too. I think I had the combobox working on the multipate too (why I think it's working and why I'm not sure, explain below). I've attached the screenshot of the new userform with the search option and listbox which I need your help with.

UserForm2

The search page/options are the way they are because of a reason. So without making the post extra extra long, reason is, there are 13 sheets, one for each month and one profitloss sheet. On the main form you first select the month from listbox and that sheet becomes active and any data entered goes in it. All this is working as it should. On the search page in this UserForm2 there are two listboxes one for the month (same as on main userform2 to select in which month goes into), up on selecting the month from listbox on the search page that page should become "active only" to perform search and next listbox is date, simply to narrow the search for that month, for example select January 2019 from first listbox and select any date from January 2019 by using date picker and in next where user can select which fields to look for. They are, Rent, Rental Admin, Misc/Holding deposit and Out. Keyword can be any from the above mentioned columns from the worksheet and then hit search and results are shown in the listbox below and by clicking edit record if any changes need to be made they can be made without duplicating the entry for that date and editing the existing entry.
Now that I've put this in words it sounds complicated! At least to me it does. I have no idea how to go about it. I can not get the Rent, Rental Admin, Misc/Holding deposit and Out to show in the listbox on multipage tab1.
I've not included any code because everything on the data entry tab0 works like a charm. I know the button to perform search is not on the userform2 but I will add it once I post this question. I need help, to make search work and to have the values which are column names really, Rent, Rental Admin and so on to show in multipage tab1. I need the results to show in listbox. I, to be honest don't know how to use excel terminologies to better explain this!
I can add code if it's needed but since daily entries tab0 is working all well and good, I don't think it's needed. But then I could be wrong, I'm no expert in excel or vba to be honest. Please if anybody can help with this I'd appreciate it very much. Thanks in advance. Cheers.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Do you have another Google Drive where you've uploaded the file? Otherwise could you post all the code that you have created so far as well as the data on here?
 
Upvote 0
Cross posted https://stackoverflow.com/questions...-with-multiple-options-and-listbox-to-display

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
@Fluff Thanks for pointing out the rule. I do apologies and should've mentioned it at the time of posting. I didn't logged on again since yesterday. So far there is no solution and I'm stuck. I do have google drive and I will add a link to the most updated file for anybody who can have a look and help. Once again my bad and thanks for your help. Cheers.


Cross posted https://stackoverflow.com/questions...-with-multiple-options-and-listbox-to-display

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
I will upload the most updated version of the file in a minute. Thanks for your comment, much appreciated. Cheers.


Do you have another Google Drive where you've uploaded the file? Otherwise could you post all the code that you have created so far as well as the data on here?
 
Upvote 0
@RileyC Many thanks for your reply, much appreciated. I did managed to add, rent, rental admin and such to combobox2. I hope my OP is clear enough that it's understandable.

In Private Sub UserForm_Initialize() I added

With ComboBox2
.AddItem "Source"
.AddItem "Rent"
.AddItem "Rental Admin"
.AddItem "Holding deposit"
.AddItem "In"
.AddItem "Out"

And now the options/values are showing on userform2 in combobox2 on multipage tab1. I wasn't able to do that when I posted the file link few hours ago. I thought I'd mention it. Thanks in advance for your help, its very much appreciated. Cheers.



I'll look over it tonight.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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