- 帖子
- 4901
- 主題
- 44
- 精華
- 24
- 積分
- 4916
- 點名
- 142
- 作業系統
- Windows 7
- 軟體版本
- Office 20xx
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台北
- 註冊時間
- 2010-4-30
- 最後登錄
- 2026-7-16
                
|
回復 6# 317 - Private Sub CommandButton1_Click()
- Me.Unprotect 12345 '取消保護
- Cells.Locked = False '儲存格取消鎖定
- If Application.CountA(Range("G3:AK100")) > 0 Then Range("G3:AK100").SpecialCells(xlCellTypeConstants).Locked = True '非空格鎖定
- Me.Protect 12345 '保護工作表
- End Sub
- Private Sub CommandButton2_Click()
- Me.Unprotect 12345 '取消保護
- If Not Intersect(Range("G3:AK100"), Selection) Is Nothing Then Selection.ClearContents
- Cells.Locked = False '儲存格取消鎖定
- If Application.CountA(Range("G3:AK100")) > 0 Then Range("G3:AK100").SpecialCells(xlCellTypeConstants).Locked = True '非空格鎖定
- Me.Protect 12345 '保護工作表
- End Sub
複製代碼 |
|