代码运行没问题 但对表进行筛选后 报错
索引超出范围。必须为非负值并小于集合大小。
参数名: index
求助 ...
代码如下
''AfterSelRangeChange
Dim s1,s2,s3 As String
With Tables("表A")
If .TopPosition > -1 Then '如果选定区域包括数据行
For i As Integer = .TopPosition To .BottomPosition
If .Rows(i)("第一列") <> "" Then
If s1 <> "" Then
s1 = s1 & "," & .Rows(i)("第一列")
Else
s1 = .Rows(i)("第一列")
End If
End If
If s2 <> "" Then
s2 = s2 & "," & .Rows(i)("第二列")
Else
s2 = .Rows(i)("第二列")
End If
Next
End If
End With
If Forms("窗口1").Opened Then
Forms("窗口1").Controls("Label1").text= s1
Forms("窗口1").Controls("Label2").text= s2
End If
此主题相关图片如下:qq截图20140327183427.png
