週六,02 2021十月
  1 回复
  7.5K訪問
0
投票
復原
有人可以幫我解決這個問題嗎? 是關於這個腳本的。
Sub
ProtectSheetCheckSpellCheck()
'Update by Extendoffice 2018/11/2
Dim
xRg 
As
Range
On
Error
Resume
Next
Application.ScreenUpdating = 
False
    
With
ActiveSheet
        
.Unprotect (
"123"
)
        
Set
xRg = .UsedRange
        
xRg.CheckSpelling
        
.Protect (
"123"
)
    
End
With
Application.ScreenUpdating = 
True
End
Sub


謝謝你。 它運行良好,只是每次運行它時它都會更改我的工作表保護設置。 我的工作表受到保護,但設置為允許用戶設置單元格、列和行的格式; 但運行此代碼後,保護設置回默認值。 我怎樣才能保留我的設置?
答案是; 您必須通過添加允許您想要的條件來修改 .protect 代碼。 工作表(“Sheet1”)。保護,:=假,允許插入列:=假,允許插入行:=假,:=假,允許過濾:=假, 
因此,如果可能的話,請幫助我使用正確的代碼,無法讓它與AllowInsertingRows.Protect(“Welkom”)一起使用,然後?????? 這個我的工作表(選項卡)被稱為 P&A 或 BIOp

我可以在原始腳本中得到它嗎?

 
嗨,Mic@sha,

要允許您的用戶設置單元格、列和行的格式,請使用以下代碼:

Sub ProtectSheetCheckSpellCheck()
'Update by Extendoffice 2021/12/20
Dim xRg As Range
On Error Resume Next
Application.ScreenUpdating = False
With ActiveSheet
.Unprotect ("123")
Set xRg = .UsedRange
xRg.CheckSpelling
'Password, Allow Formatting Cells, Allow Formatting Columns, Allow Formatting Rows
.Protect Password:="123", AllowFormattingCells:=True, AllowFormattingColumns:=True, AllowFormattingRows:=True
End With
Application.ScreenUpdating = True
End Sub


阿曼達
  • 頁:
  • 1
有沒有為這個職位尚未作出回复。