Screen goes white while sorting

gemini528

Board Regular
Joined
Jun 13, 2013
Messages
53
Hello Excel Gurus,

Whenever I the run code below, the screen goes white for 3 seconds (or until the sorting is done) then the normal black background. What I want is to eliminate the white background while sorting the data. Any suggestion or revision or addition on the code will be appreciated

Thank you very much.

Here is the code:
VBA Code:
Sub Sort()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
  With Sheets("INVTRY")
   .Unprotect Password:="password"
    With .Range("B4:F5000")
      .Cells.Sort Key1:=.Columns(Application.Match("TR DATE", .Rows(1), 0)), Order1:=xlAscending, _
                  Key2:=.Columns(Application.Match("ITEM NO", .Rows(1), 0)), Order2:=xlAscending, _
                  key3:=.Columns(Application.Match("DESC", .Rows(1), 0)), Order3:=xlAscending, _
                    Orientation:=xlTopToBottom, Header:=xlYes 'comma then space then underscore then ENTER key
    End With
   .Protect Password:="password", DrawingObjects:=False, UserInterfaceOnly:=True, Contents:=True, _
                           Scenarios:=True, AllowFiltering:=True, _
                           AllowFormattingCells:=True, AllowSorting:=True
  End With
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
As far as i can see Me.Repaint is not valid for use with a worksheet / workbook. All of the examples that I've seen are for userforms.
 
Upvote 0

Forum statistics

Threads
1,213,556
Messages
6,114,284
Members
448,562
Latest member
Flashbond

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top