Search code help needed

Sharid

Well-known Member
Joined
Apr 22, 2007
Messages
1,066
Office Version
  1. 2016
Platform
  1. Windows
I have this piece of code that allows a customer record to be searched via surname and then it displays the name in a textbox. so if the customers name was John Smith I need to type in Smith and click the find button on the useform and it will display it as Smith John, the search bit is fine and I have no issue with the name being back to front.

I want the range to include more information, currently the surname is in column 2 and the info for column 2 + 3 are only displayed. I want the info for column 1 to 9 to be displayed in the textbox.

Private Sub cmdFind_Click()
Dim SearchItem As String
Dim Error

If (tbFindLastName.Text = Empty) Or (tbFindLastName.Text = " ") Then
Error = MsgBox("I have nothing to search for!", vbExclamation, "Search Error!")
Else
SearchItem = tbFindLastName.Text
tbFindLastName.Text = Empty
SelectItem (SearchItem)
End If
End Sub
 
Last edited:

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Hi

i'm still stuck on this can anyone help :hammer::banghead:
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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