C
Casey
Good Morning,
I have an event procedure that locks up when the copy and paste
commands are used on the worksheet. I looked up some code I remembered
from John Walkenbach's book "Excel 2000 Power Programming with VBA"
about stopping endless loops and found the code for an AbortProc but I
have been unable to make it work for my code. Could somebody let me
know if I'm even on the right path or have I just not applied John's
code correctly to my code. Also, is there a way using the AutoFit
method to set a minimum column width to not go below? Thanks for the
help.
Here is my code:
Private Sub Worksheet_Change(ByVal Target As Range)
Static AbortProc As Boolean
If AbortProc Then Exit Sub
If Not Intersect(Target, Range("C:F")) Is Nothing Then
AbortProc = False
Application.ScreenUpdating = False
ActiveSheet.Unprotect ("geekk")
With ActiveSheet
AbortProc = True
..Cells.Columns("F:L").AutoFit
AbortProc = False
End With
ActiveSheet.Protect ("geekk")
Application.ScreenUpdating = False
AbortProc = False
End If
AbortProc = False
End Sub
I have an event procedure that locks up when the copy and paste
commands are used on the worksheet. I looked up some code I remembered
from John Walkenbach's book "Excel 2000 Power Programming with VBA"
about stopping endless loops and found the code for an AbortProc but I
have been unable to make it work for my code. Could somebody let me
know if I'm even on the right path or have I just not applied John's
code correctly to my code. Also, is there a way using the AutoFit
method to set a minimum column width to not go below? Thanks for the
help.
Here is my code:
Private Sub Worksheet_Change(ByVal Target As Range)
Static AbortProc As Boolean
If AbortProc Then Exit Sub
If Not Intersect(Target, Range("C:F")) Is Nothing Then
AbortProc = False
Application.ScreenUpdating = False
ActiveSheet.Unprotect ("geekk")
With ActiveSheet
AbortProc = True
..Cells.Columns("F:L").AutoFit
AbortProc = False
End With
ActiveSheet.Protect ("geekk")
Application.ScreenUpdating = False
AbortProc = False
End If
AbortProc = False
End Sub