Command Button to search data and populate fields in a userform

kidwispa

Active Member
Joined
Mar 7, 2011
Messages
330
Hi,

I have very little experience with VBA in Excel and would really appreciate some help, as I've tried searching for what i need and I can't find anything specific on google.

I am in the process of creating a userform that will show company details, and would really like it to be able to enter an account number which when the command button is clicked, will populate other company details on the form.

I currently have the following fields:

TextBox25 - this is the field where the account number will be entered

CommandButton5 - this is the button I would like to click in order to search for the account number input in TextBox25, and populate the below fields:

TextBox26 - Company Name

TextBox28 - Company Address

The data that it will be searching from is in a tab entitled 'Company Details' and the relevant data is in the following columns:

Account Number = Column A
Company Name = Column C
Company Address = Column J

I hope this makes sense to somebody out there and would like to thank you in advance for any help given!

:)
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Thanks for taking the time to reply - I will have a search through the forum and see what I can find, although the link you gave me seems to be related to listboxes/comboboxes which I don't think would necessarily be the best option for what I need to do - currently we have over 7,000 different account numbers and the user that would be inputting them would know the exact code they required, so I think keying the account number into a text box and then using a command button to search and populate the other required fields would be the ideal choice if possible.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,827
Members
452,946
Latest member
JoseDavid

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