求助,一段代码实现(不要3列3段代码) 列名中壹字的(壹1、壹2、壹3这三列)值=对的行筛选
Dim s As String = "1=1 "
For Each C As Col In Tables("表A").Cols
If C.Name.Contains("壹") Then
Tables("表A").Filter = "对"
End If
Next
[此贴子已经被作者于2024/7/25 9:56:57编辑过]
Dim 列名集 As New List(Of String)(Tables("表A").Cols.Where(Function(列) 列.Name.Contains("壹")).Select(Function(列) 列.Name & "='对'"))
Tables("表A").Filter = String.Join(" or ", 列名集)
使用linq看似简练,但是很多人都看不懂,虽然可以解决问题,但是达不到理解进步的可能。
Dim s As String = "1=2 "
For Each C As Col In Tables("表A").Cols
If C.Name.Contains("壹") Then
s = s & " or " & C.Name & "='对'"
End If
Next
Tables("表A").Filter = s