Diving_Dan
Board Regular
- Joined
- Oct 20, 2019
- Messages
- 161
Hi all,
I am having a nightmare trying to get a userform to search for data in a worksheet and display the data in the userform. I have googled and youtubed as I'm still very new to VBA and tried several different ways of trying to make it work but it won't so am having to ask.
The worksheet where I want to pull the data from is called "Hidden Stuff". It is a worksheet that holds a whole range of data for different things for the workbook.
The data I want to search for is in columns "L:Q". I have a textbox on the userform called textEmployeeID. I want to be able to add an employee ID into the textbox, click search, look to column L for that employee ID and then return the data from the row. Column M to textSurname, Column N to textFirstName, Column O to textPayNo, Column P to cboGrade and Column Q to textTelephoneNo. There are blank cells in column Q if i don't have a telephone number for the employee.
Whilst I'm asking I might as well go all out. The textboxes and combobox are locked so the data can't be edited. I have a command button that I click that unlocks them all so I can change them and then another command button to lock them again. Once i've changed any data I would like to be able to click a command button called save cmdSave to amend the data in the worksheet that I originally pulled to the userform.
I hope i'm not asking too much but i've tried so many different things and can't even get the search to work.
Thanks in advance.
I am having a nightmare trying to get a userform to search for data in a worksheet and display the data in the userform. I have googled and youtubed as I'm still very new to VBA and tried several different ways of trying to make it work but it won't so am having to ask.
The worksheet where I want to pull the data from is called "Hidden Stuff". It is a worksheet that holds a whole range of data for different things for the workbook.
The data I want to search for is in columns "L:Q". I have a textbox on the userform called textEmployeeID. I want to be able to add an employee ID into the textbox, click search, look to column L for that employee ID and then return the data from the row. Column M to textSurname, Column N to textFirstName, Column O to textPayNo, Column P to cboGrade and Column Q to textTelephoneNo. There are blank cells in column Q if i don't have a telephone number for the employee.
Whilst I'm asking I might as well go all out. The textboxes and combobox are locked so the data can't be edited. I have a command button that I click that unlocks them all so I can change them and then another command button to lock them again. Once i've changed any data I would like to be able to click a command button called save cmdSave to amend the data in the worksheet that I originally pulled to the userform.
I hope i'm not asking too much but i've tried so many different things and can't even get the search to work.
Thanks in advance.