方法一:
For x As Integer = 2 To 12
For Each r As Row In tb.Rows
cl = sheet(x,0).value
lx = sheet(x,2).value
ys = sheet(x,3).value
Dim flag As Boolean = True
If cl <> "" Then
flag = flag AndAlso (r("材料") = cl)
End If
If lx <> "" Then
flag = flag AndAlso (r("类型") = lx)
End If
If ys <> "" Then
flag = flag AndAlso (r("钥匙").contains(ys))
End If
If flag Then
'If r("材料") = cl AndAlso r("类型") = lx AndAlso r("钥匙").contains(ys) Then
For i As Integer = 4 To tb.Cols.Count -1
If r.Isnull(i) = False Then
If sheet(x,i+2).value <> "" Then
sheet(x,i+2).value = sheet(x,i+2).value + r(i)
Else
sheet(x,i+2).value = r(i)
End If
End If
Next
End If
Next
Next