我正在尝试验证工作表“BY Blocs”中的列。首先,我从列G的下拉列表中选择一个值然后将字符串拆分为列中的3个新字符串NI要检查每个新的子字符串如果存在于表单“列表”中。直到现在它只检查一个单元格,但我想检查所有单元格的值,如果它们存在于表单“列表”中的相应列中。例如: 如果我选择“C1 merge 2”
检查C1是否在columnNames列中?
是否在dnymicFormat列中合并?
是2个有效整数?
If Target.Row > 2 And Target.Column = 7 Then
Dim arr As Variant
arr = Split(Target.Value, ",")
Range("N:N").ClearContents
Range("N:N").NumberFormat = "@"
Range("N3:N" & UBound(arr) + 1) = WorksheetFunction.Transpose(arr)
End If
Dim obj As Long
Dim lr As Long
For Each cell In Range("N3:N")
If Not (IsEmpty(cell)) Then
If cell.Value = Worksheets("Lists").Range("P4").Value Then
MsgBox "The value is in column ColumnNames"
Else
If cell.Value = Worksheets("Lists").Range("O4").Value Then
MsgBox "The value is in column DynamicFormat"
Else
If cell.Value = Worksheets("Lists").Range("N4").Value Then
MsgBox "The value is in column Integer"
End If
End If
End If
End If
Next cell
End Sub