如何在受保护的Excel表上启用单元格重新大小

时间:2021-12-06 21:25:53

I have a macro that disable some row based on the value of others row , witch is working fine

我有一个宏,可以根据其他行的值禁用某些行,女巫运行良好

 Private Sub Worksheet_Change(ByVal Target As Range)
    Call SecurityColumnsLookup(Target)
End Sub
Private Sub Workbook_Open(ByVal Target As Range)
    Call SecurityColumnsLookup(Target)
End Sub
Private Sub SecurityColumnsLookup(ByVal Target As Range)
On Error GoTo MyErr
    Err.Clear
    ActiveSheet.Unprotect

    Application.EnableEvents = False
 Select Case Range("V" & (Target.Row)).Value
   //do stuff


    End Select
 ActiveSheet.Protect
    Application.EnableEvents = True
    Exit Sub
MyErr:
    On Error Resume Next
 ActiveSheet.Protect
    Application.EnableEvents = True
    Exit Sub
End Sub
 Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        Call SecurityColumnsLookup(Target)
    End Sub

What I would like to know is how to add code to my Macro in order to allow user to re-size his rows , because what is happening right now , is when the macro is active and I mouse mouse over the cell the re-size icon doesn't appear

我想知道的是,如何向我的宏添加代码,以允许用户重新调整他的行大小,因为现在正在发生的是,当宏处于活动状态时,我在单元格上单击鼠标,重新大小的图标将不会出现

Is it possible to enable re-sizet feature at any time?

是否可以在任何时候启用resizet功能?

Thank you

谢谢你!

1 个解决方案

#1


1  

I found the solution to my problem , as explained in this link

我找到了我的问题的解决方案,正如在这个链接中解释的那样

http://www.thespreadsheetguru.com/the-code-vault/2014/2/21/protect-worksheet-but-allow-formatting-and-hiding-rows-columns

http://www.thespreadsheetguru.com/the-code-vault/2014/2/21/protect-worksheet-but-allow-formatting-and-hiding-rows-columns

Adding this

添加这个

    ActiveSheet.Protect , AllowFormattingColumns:=True, AllowFormattingRows:=True
Application.EnableEvents = True

Will let my Macro enable the resize option !

将让我的宏启用调整大小选项!

#1


1  

I found the solution to my problem , as explained in this link

我找到了我的问题的解决方案,正如在这个链接中解释的那样

http://www.thespreadsheetguru.com/the-code-vault/2014/2/21/protect-worksheet-but-allow-formatting-and-hiding-rows-columns

http://www.thespreadsheetguru.com/the-code-vault/2014/2/21/protect-worksheet-but-allow-formatting-and-hiding-rows-columns

Adding this

添加这个

    ActiveSheet.Protect , AllowFormattingColumns:=True, AllowFormattingRows:=True
Application.EnableEvents = True

Will let my Macro enable the resize option !

将让我的宏启用调整大小选项!