find value of userform textbox in a cell

lefika

New Member
Joined
Oct 1, 2009
Messages
17
Hi,

I'm still learning VBA so I'm struggling a bit. I have a userform where I want to enter a search term in a text box. The idea is that the code looks for whatever is entered in that text box within a sheet where I have entered search terms for every row in column 5.

For instance, cells(2,5) contain the following:
"valid, validate, validation, complete, completed"

I want to enter (for instance) "validate" in the textbox and have the code look for "validate" in all the rows in column 5 and if it finds it, return the value of the cell in that row but from the first column. I want this value to be returned within another textbox in the userform.

Sorry for the long explanation. Hope someone can help!

Thanks!
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hi

Maybe something like

Code:
    Dim Inp, Outp
    Dim Rng As Range
    Inp = TextBox1.Value
    With Sheets("Sheet1").Range("E:E")
        Set Rng = .Find(what:=Inp, after:=.Cells(.Rows.Count, 1), LookIn:=xlValues, _
                            LookAt:=xlPart, _
                            SearchOrder:=xlByRows, _
                            SearchDirection:=xlNext, _
                            MatchCase:=False)
        If Not Rng Is Nothing Then
            Outp = Rng.Offset(0, -4).Value
            TextBox2.Value = Outp
        End If
    End With
<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden"><input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Last edited:
Upvote 0
how can i find a value or text from csv file in userform text box.
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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