Dim s1,s2,s3 As String With Tables("表A") If .RowSel < 0 OrElse .ColSel < 0 Then Return End If 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 With If Forms("窗口1").Opened Then Forms("窗口1").Controls("Label1").text= s1 Forms("窗口1").Controls("Label2").text= s2 End If