Excel 检查验证InputItle或InputMessage是否为空
我已经创建了一个UserForm,用于向工作表上的特定单元格添加注释。我以前使用另一个工作表来存储评论。然而现在我已经发现我可以直接从验证InputItle和InputMessage中获取值 我的问题是如何分别检查每一项的“验证InputItle或InputMessage是否为空” 我尝试了以下方法:Excel 检查验证InputItle或InputMessage是否为空,excel,vba,Excel,Vba,我已经创建了一个UserForm,用于向工作表上的特定单元格添加注释。我以前使用另一个工作表来存储评论。然而现在我已经发现我可以直接从验证InputItle和InputMessage中获取值 我的问题是如何分别检查每一项的“验证InputItle或InputMessage是否为空” 我尝试了以下方法: Private Sub CommandButton28_Click() On Error Resume Next Me.TextBox1.Value = ActiveCell.V
Private Sub CommandButton28_Click()
On Error Resume Next
Me.TextBox1.Value = ActiveCell.Validation.InputTitle
Me.TextBox2.Value = ActiveCell.Validation.InputMessage
End Sub
但是,即使Validation.InputMessage
为空,这只更新我的第一个框(TextBox1)和TextBox2的值
我也尝试过:
Private Sub CommandButton28_Click()
If Not IsEmpty(ActiveCell.Validation.InputTitle) Then
Me.TextBox1.Value = ActiveCell.Validation.InputTitle
End If
If Not IsEmpty(ActiveCell.Validation.InputMessage) Then
Me.TextBox2.Value = ActiveCell.Validation.InputMessage
End If
End Sub
这甚至无法编译。这似乎起作用了:
Private Sub CommandButton28_Click()
On Error Resume Next
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox1.Value = ActiveCell.Validation.InputTitle
Me.TextBox2.Value = ActiveCell.Validation.InputMessage
End Sub
这似乎在起作用:
Private Sub CommandButton28_Click()
On Error Resume Next
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox1.Value = ActiveCell.Validation.InputTitle
Me.TextBox2.Value = ActiveCell.Validation.InputMessage
End Sub
尝试替换:
If Not IsEmpty(ActiveCell.Validation.InputTitle) Then
Me.TextBox1.Value = ActiveCell.Validation.InputTitle
End If
If Not IsEmpty(ActiveCell.Validation.InputMessage) Then
Me.TextBox2.Value = ActiveCell.Validation.InputMessage
End If
与
尝试替换:
If Not IsEmpty(ActiveCell.Validation.InputTitle) Then
Me.TextBox1.Value = ActiveCell.Validation.InputTitle
End If
If Not IsEmpty(ActiveCell.Validation.InputMessage) Then
Me.TextBox2.Value = ActiveCell.Validation.InputMessage
End If
与