如何在受保护的工作表中更新表单控件标题?

时间:2019-03-15 14:43:08

标签: excel vba

我有一个表单控件,希望它的标题在两个条目之间更改。工作表受到保护,但是即使我正在更改userinterfaceonly = true并允许drawingobjects = true仍不能更改!这是一个错误还是我做错了什么?我试图避免uprotect ==>修改==>保护解决方法。

Sub ShowChangesOnly()
Dim ws As Worksheet, Rng As Range, Criteria As Range, Btn As Object
    Set ws = ThisWorkbook.Sheets("Tod")
    ws.Protect , True, , , True, , , , , , , , , True, True
    Set Btn = ws.Buttons("Button 1")
    Set Rng = ws.Range("TodayD")
    Set Criteria = ws.Range("Criteria")
    RemoveFilters ws
    If Btn.Caption = "Filter Changes" Then
        Rng.AdvancedFilter xlFilterInPlace, Criteria
        Btn.Caption = "Show All"
        MsgBox "Total of " & Rng.Columns(3).SpecialCells(12).Count - 1 &  _
          " Found as Having Changes."
        Else
            Btn.Caption = "Filter Changes"
        End If
    End Sub

先谢谢了。

干杯,
M

1 个答案:

答案 0 :(得分:1)

您希望绘图对象为假,

来自帮助:True to protect shapes. The default value is True.