I am using the following code in the Worksheet_Change. However, I am using other macros within the same Worksheet as well. When I run the macros (see sample below), because the Worksheet_Change is protecting the Worksheet, the macros will not run.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrorHandler
Application.EnableEvents = False
ActiveSheet.Unprotect ("1") ''''''''''''''''''Re-Activate
With Target
If .MergeCells And .WrapText Then
Set c = Target.cells(1, 1)
cWdth = c.ColumnWidth
Set ma = c.MergeArea
For Each cc In ma.cells
MrgeWdth = MrgeWdth + cc.ColumnWidth
Next
Application.ScreenUpdating = False
ma.MergeCells = False
c.ColumnWidth = MrgeWdth
c.EntireRow.AutoFit
NewRwHt = c.RowHeight
c.ColumnWidth = cWdth
ma.MergeCells = True
ma.RowHeight = NewRwHt
cWdth = 0: MrgeWdth = 0
Application.ScreenUpdating = True
End If
ActiveSheet.Protect ("1") ''''''''''''''''''Re-Activate
End With
Application.ScreenUpdating = True
ErrorHandler:
Application.EnableEvents = True
End Sub
Sub Office_Counter_E()
Application.ScreenUpdating = False
Sheet17.Unprotect ("1")
Sheet17.Range("AC5").Value = 1
Sheet17.Range("AD5").Value = ""
Sheet17.Range("AE5").Value = ""
Sheet17.Range("AF5").Value = ""
Sheet17.Range("AG5").Value = ""
Sheet17.Protect ("1")
Application.ScreenUpdating = True
End Sub