[英]Validate cell value in one column based on cell value in another column
I want to validate three columns in Excel. 我想验证Excel中的三列。
Here is my code: 这是我的代码:
rowToValidate = ActiveCell.Row
colToValidate = ActiveCell.Column + 1
Dim celAdd As String
celAdd = rowToValidate + colToValidate
Different ways to do this but here's one approach, assuming the columns are side-by-side. 做到这一点的方法不同,但这是一种方法,假设各列是并排的。 You can adjust the
Offset
as necessary. 您可以根据需要调整
Offset
。
Sub Test()
If Not IsEmpty(ActiveCell.Value) And _
IsEmpty(ActiveCell.Offset(, 1).Value) And _
IsEmpty(ActiveCell.Offset(, 2).Value) Then
' Do whatever you wanted to do
End If
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.