Run macro without "screen flicker"

alexbat

New Member
Joined
Dec 12, 2013
Messages
32
Hi,

I´m trying to understand how to run a macro from Sheet 1 in a workbook that changes Sheet 3.

Running this code

Code:
Sub Test1()
  
    Worksheets("Sheet3").Activate
    Range("H4").Select
    ActiveCell.FormulaR1C1 = "A"
    Range("H5").Select
    Worksheets("Sheet3").Activate
    
End Sub

Excel switches between Sheet 1 and Sheet 3. How could I do instead to run the script from Sheet 1 without switching to Sheet 3 and back?

Thank you in advance!
 
...that will sort and do advanced filtering in Sheet 3, but I want to stay in Sheet 1.
Try something like this:
Code:
With Sheets("Sheet3")
  .Columns("A:B").Sort Key1:=.Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
     OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
  .Columns("A:B").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
End With
You won't need to deal with the screen updating (on or off) with this either.

Hope it helps.
 
Upvote 0

Forum statistics

Threads
1,226,857
Messages
6,193,382
Members
453,792
Latest member
Vic001

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