- 帖子
- 18
- 主題
- 6
- 精華
- 0
- 積分
- 73
- 點名
- 1
- 作業系統
- window
- 軟體版本
- google
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2017-6-27
- 最後登錄
- 2025-3-7
|
有關保護工作表代碼無法將工作表隱藏的項目隱藏
當執行checklocksheet時,無法將工作表設定儲存格格式為隱藏的項目隱藏,原本電腦為win10-excel2019都沒有問題,到win11-excel365商務版時就會跑完程式碼卻還是可以看到已經儲存格格式為鎖定及隱藏的儲存格
- Private Sub checklocksheet()
- Dim strPassword As String
- strPassword = "123456789"
- Sheets("工作表1").Select
- ActiveSheet.Protect Password:=strPassword, _
- DrawingObjects:=True, _
- Scenarios:=True, _
- AllowFormattingCells:=True, _
- AllowFormattingColumns:=True, _
- AllowFormattingRows:=True, _
- AllowInsertingColumns:=True, _
- AllowInsertingRows:=True, _
- AllowInsertingHyperlinks:=True, _
- AllowDeletingColumns:=True, _
- AllowDeletingRows:=True, _
- AllowSorting:=True, _
- AllowFiltering:=True, _
- AllowUsingPivotTables:=True
- Sheets("工作表2").Select
- ActiveSheet.Protect Password:=strPassword, _
- DrawingObjects:=True, _
- Scenarios:=True, _
- AllowFormattingCells:=True, _
- AllowFormattingColumns:=True, _
- AllowFormattingRows:=True, _
- AllowInsertingColumns:=True, _
- AllowInsertingRows:=True, _
- AllowInsertingHyperlinks:=True, _
- AllowDeletingColumns:=True, _
- AllowDeletingRows:=True, _
- AllowSorting:=True, _
- AllowFiltering:=True, _
- AllowUsingPivotTables:=True
- End Sub
複製代碼 |
|