Re: Search function to populate a userform
Hi,
Thank you for above but it doesn't seem to work.
The issue I have is that the worksheet is going to contain 40+ columns of data and 600+ rows of data and counting. What I need to do is input some search criteria into 1 or more of the boxes i have created and it then display the results in the list box. In theory, if I only put 1 piece of data in to any of the boxes, then the results will be multiple. If i enter 2 or 3 pieces of data, the results will be narrowed down and display maybe 1 or 2 rows.
Ultimate aim: - This application is to be used to control stock and sales. I have already built an input userform to put data into the excel sheet (works fine), but occasionally, I will need to go back in to that data and change a piece, I.e. in this example, if we then sell that piece of stock to another customer, I need to be able to change the customer. The userform I have works perfectly to add the data to a new row in the worksheet, however I need a way of using a 'search' function somehow to select a row of data from the sheet, load that row into an identical userform to the first one, change the data as required and then 'save' the new information over the old row. But I am struggling.
I do not need all 40 rows to be searched, only maybe 3 or 4 criteria I have put in the existing search userform, this should be sufficient to narrow down the results.
I can get the boxes in the Search userform to display the data, no problem. What i am struggling with is the code for behind the search button that then looks at the data inputted into the combo/textboxes and finds them matching rows in the worksheet. Step 1.
Step 2, clicking on one of the results in the Listbox and that rows data transferring to the complete Userform for editing.
Step 3, changing the data and the userform 'amend' button replacing that rows data with the new data, not creating a new row.
I apologise for the newbie-ness but I am learning on the go here. Any help is massively appreciated.
Kind Regards
Tom