swaggerbox
11-28-2019, 04:20 AM
I have a macro that searches a textbox for diseases listed in a range (acty sheet column A). Is there a way I can output the results to 1) combo box, 2) listbox, or 3) on the existing sheet. I want three different examples so I know how to deal with them in the future. Attached is the representative sample. Hope someone can help me.
Public Sub T()
Dim sSentence As String
Dim s As Variant
Dim sDict As Variant
Dim last As Long
last = Sheets("Acty").Range("A65536").End(xlUp).Row
sDict = Sheets("Acty").Range("A1:A" & last)
sSentence = Sheets("GUI").TextBox1
For Each s In sDict
If InStr(1, sSentence, Trim$(s), VbCompareMethod.vbTextCompare) > 0 Then
MsgBox s
Else
End If
Next
End Sub
Public Sub T()
Dim sSentence As String
Dim s As Variant
Dim sDict As Variant
Dim last As Long
last = Sheets("Acty").Range("A65536").End(xlUp).Row
sDict = Sheets("Acty").Range("A1:A" & last)
sSentence = Sheets("GUI").TextBox1
For Each s In sDict
If InStr(1, sSentence, Trim$(s), VbCompareMethod.vbTextCompare) > 0 Then
MsgBox s
Else
End If
Next
End Sub