通过在Excel电子表格中查找特定单词来填充用户表单中的列表框

时间:2018-05-22 06:51:37

标签: vba excel-vba userform excel

我正在尝试通过查找包含单词" Lisa"的字段来创建一个用户表单。然后使用offset函数将下面单元格的内容添加到我的列表框中。

我当前的代码只显示列表框但没有内容:

Sub Lab_ClearProcess()

'look for "Lisa"
Dim rngFound As Range
With ActiveSheet.cells
    Set rngFound = .Find("Lisa", LookIn:=xlValues)
    If Not rngFound Is Nothing Then
        'something is found
        'select box in row below
        'display text in list box
        ActiveCell.Offset(1, 0).Select
        UF_ClearForm.ListBox1.AddItem
    Else
        'nothing found, show text box saying "No Processes can be found"
        MsgBox "No Processes can be found"
    End If
End With

UF_ClearForm.Show

End Sub

非常感谢任何帮助:)

0 个答案:

没有答案