UserForm Search Function

cmerrick

Board Regular
Joined
Jun 8, 2017
Messages
78
Office Version
  1. 365
Platform
  1. Windows
Good morning all,

I have a code that I am using to enable a UserForm to display info about employees. The user is then able to amend the data and the spreadsheet updates. I've got a search function working but I want the user to be able to search with one option OR the other option not a combination of the two.

My code is below.

Help is much appreciated.

Code:
Private Sub CommandButton3_Click()
row_number = 0
Do
DoEvents
row_number = row_number + 1
item_in_review = Sheets("All").Range("A" & row_number)
    If item_in_review = NetworkuserSearch.Text Then
        Sheets("All").Range("C" & row_number) = EmployeeIdSearch.Text
        Sheets("All").Range("D" & row_number) = FullnameSearch.Text
        Sheets("All").Range("B" & row_number) = Initials.Text
        Sheets("All").Range("E" & row_number) = Appteam.Text
        Sheets("All").Range("F" & row_number) = Deptcode.Text
        Sheets("All").Range("G" & row_number) = teamcode.Text
        Sheets("All").Range("H" & row_number) = Jobtitle.Text
        Sheets("All").Range("I" & row_number) = emailaddress.Text
        Sheets("All").Range("J" & row_number) = telephoneext.Text
        Sheets("All").Range("K" & row_number) = faxext.Text
        Sheets("All").Range("L" & row_number) = eventassign.Text
        Sheets("All").Range("M" & row_number) = signature.Text
        
     End If
Loop Until item_in_review = ""
        
If MsgBox("Are you sure you wish the submit these changes?", vbQuestion + vbYesNo) <> vbNo Then
     
Unload Me
Else
End If
        
End Sub
 
I'm sorry, the document is in my work computer and we don't have access to dropbox here

issue I have is I have been writing out code with suggested changes for you & what you post back contains none of my suggestions - What you want to do is not that difficult but to go forward, would be really helpful if could see copy of your workbook with some sample data.

Dave
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I do appreciate you help and I'm sorry if you feel I have deflected the assistance you have given me. I can assure you that I have not and I've taken it all on board and will certainly experiment with in in future project.

The code you originally provided to transfer data from the spreadsheet to the user for and populate the option boxes didn't work or maybe I didn't key it correctly. Whilst waiting for a response, which you have always swiftly provided I played around with some of my own code and managed to get it to work it's just you would probably be able to simply the code 100%.

I apologise if I have come across as ungrateful in anyway, it was not my intention.
 
Upvote 0
I apologise if I have come across as ungrateful in anyway, it was not my intention.

No suggestion you were ungrateful - it just causes a little confusion when send one thing & get back another.

If you now have it working then that's all that' important.

Dave
 
Upvote 0

Forum statistics

Threads
1,216,165
Messages
6,129,235
Members
449,496
Latest member
Patupaiarehe

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