New Member
April 2, 2019
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
1 Guest(s)