1

我想从数据验证中删除帮助按钮。在 excel 2003 数据验证中,此按钮不存在,但现在我想将其从 excel 2007 数据验证错误中删除。请不要问为什么要删除帮助按钮。

我的项目类型是visual studio 2008的excel模板。

Excel 2007数据验证错误的SS

编辑

除了 Worksheet_Change 之外,还有其他方法可以完成这件事吗?我认为这可能会降低性能。

4

1 回答 1

4

如果您使用的是内置数据验证,则无法删除帮助按钮。建议您简单地使用帮助按钮,因为唯一已知的解决方法是重新创建 Excel 的内置功能非常耗时。

您需要创建一个自定义 msgbox 来侦听 Worksheet Change 并检查值。这是一个基本上取自这里的 VBA 示例:

Private Sub Worksheet_Change(ByVal Target As Range)
dim msg as string
dim Style as string
dim Title as string
dim Response as long
'Update Cells to be the actuall range you want to validate
If Intersect(Target, Cells(1, 2)) Then
    If Cells(1, 2).Value <> "whatever" Then
        msg = "Value must be LT 1"
        Style = vbRetryCancel + vbCritical
        Title = "Mt Error"
        Response = MsgBox(msg, Style, Title)
    End If
End If
End Sub
于 2012-10-18T14:46:24.193 回答