为什么我无法使用excel VBA更新Listbox的RowSource属性?

Phe*_*ndy 0 excel vba excel-vba

我的用户窗体在属性窗口中的样子: 用户窗体

这是我的代码:

With Worksheets("List of Accounts").ListObjects("ListofAccounts").ListColumns(1).Range
    Total_rows_Accounts = .Find(What:="*", _
    After:=.Cells(1), _
    Lookat:=xlPart, _
    LookIn:=xlFormulas, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlPrevious, _
    MatchCase:=False).Row
End With

If Total_rows_Accounts > 1 Then
    lbxCurrent.RowSource = "List of Accounts!A2:A4"
End If
Run Code Online (Sandbox Code Playgroud)

我的工作表看起来像什么:

账户清单

错误:

错误

Tom*_*Tom 7

你的范围不正确.应该是lbxCurrent.RowSource = "'List of Accounts'!A2:A4"由于工作表名称中的空格而导致错误