【发布时间】:2021-06-26 06:33:13
【问题描述】:
我收到一个名为(运行时错误“13”;类型不匹配)的错误。 我是 VBA 新手,如果这是一个愚蠢的问题,我很抱歉。
BaseForm = 我的用户表单
将 iRow 和 iCol 调暗为整数
sub refresh_data() '刷新列表框数据
Set ws = ThisWorkbook.Sheets("DATA")
iRow = ws.Cells(Rows.Count, 1).End(xlUp).Row
iCol = ws.Cells(1, Columns.Count).End(xlToLeft).Column
With BaseForm
.ListBox1.ColumnCount = iCol
.ListBox1.ColumnHeads = True
If iRow > 1 Then
.ListBox1.RowSource = Range(Cells(1, 1), Cells(iRow, iCol))
Else
.ListBox1.RowSource = Range(Cells(1, 1), Cells(1, iCol))
End If
End With
结束子
【问题讨论】:
-
试试THIS