P
Patrick C. Simonds
In the code below I use Application.EnableEvents = False to prevent the
showing of UserForm1 while the code is running. The problem is that it
prevents all events from happening. Is there any way to prevent UserForm1
from showing while still allowing other events to happen?
Private Sub CommandButton1_Click()
Unload End_Of_Month_Disposal
Application.EnableEvents = False
Application.ScreenUpdating = False
ActiveWorkbook.Worksheets("2009 Training").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("2009 Training").Sort.SortFields.Add
Key:=Range( _
"A3:A5000"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("2009 Training").Sort
.SetRange Range("A2:N5000")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("B2").Select
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
showing of UserForm1 while the code is running. The problem is that it
prevents all events from happening. Is there any way to prevent UserForm1
from showing while still allowing other events to happen?
Private Sub CommandButton1_Click()
Unload End_Of_Month_Disposal
Application.EnableEvents = False
Application.ScreenUpdating = False
ActiveWorkbook.Worksheets("2009 Training").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("2009 Training").Sort.SortFields.Add
Key:=Range( _
"A3:A5000"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("2009 Training").Sort
.SetRange Range("A2:N5000")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("B2").Select
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub