Forum

Notifications
Clear all

Keyword Search

2 Posts
2 Users
0 Reactions
88 Views
(@gokul112233)
Posts: 1
New Member
Topic starter
 

Hi All,

I am trying to find the keywords into one sheet to another using userform Listbox & Textbox.

Textbox - will contain the data

ListBox - contain the Keywords

 

I need to display the clicked word in msgbox

 

speed response expected 

 

Code is as follows :

*****************************************************************************************************

Option Compare Text

Private Sub CommandButton1_Click()

Dim counttxt As String
Dim mytxt As String
Dim dollarcount As Long

dollarcount = 0

ListBox1.Clear
If TextBox1.Text = "" Then
MsgBox "please input the raw data"
Else

ListBox1.Visible = True

lastrow = Sheets("Input").Cells(Rows.Count, "A").End(xlUp).Row

For i = 0 To lastrow - 2

counttxt = Sheets("Input").Cells(i + 2, 1).value
mytxt = TextBox1.Text
dollarcount = (Len(mytxt) - Len(Replace(mytxt, counttxt, ""))) / Len(mytxt)

counttxt = counttxt & dollarcount

If dollarcount > 0 Then

ListBox1.AddItem counttxt

End If

Next

End If

End Sub

*********************************************************************************

 

Regards,

Gokul S

 
Posted : 18/12/2019 1:32 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Please supply your workbook and data so we can see what you are working with.  Otherwise we have to recreate everything from scratch and this probably won't match your environment.

Regards

Phil

 
Posted : 19/12/2019 12:55 am
Share: