可能是单元格的文本没有那么多行,超过了。
修改为,如果调用时的参数Line超过了单元格的文本行数,则返回空的字符串。
Function GetCellTextLine(i As Integer, j As Integer, Line As Integer)
Dim S$, V
S = Cells(i, j).Text
V = Split(S, Chr(10))
If Line > UBound(V) + 1 Then
GetCellTextLine = ""
Else
GetCellTextLine = V(Line - 1)
End If
End Function
错误不在这一段程序里,在你的用户管理窗体里,应该是初始化的时候数组下标越界了