VBA code to remain in the same page while running the macro

Balajibenz

Board Regular
Joined
Nov 18, 2020
Messages
56
Office Version
  1. 2013
Platform
  1. Windows
I have a VBA code with multiple subs and it has multiple worksheets which will be hided and only macro worksheet will be visible.

when someone runs the macro it will unhide the other worksheets and exports the output then at the end it hides the worksheets.

problem is at times towards the end of the code the workbook flickers and it showing the worksheets that are supposed to be not visible and once success message it shown and once i click on "ok" the it seems fine. I have used below lines but it is still the same.

Application.DisplayAlerts = False
Application.ScreenUpdating = False

can someone help me with this.

all i want it is to have only the worksheet named "Macro" visible while code is running.
 

Some videos you may like

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

xlyfe

Board Regular
Joined
Aug 28, 2020
Messages
53
Office Version
  1. 365
Platform
  1. Windows
You could maybe try to wrap it in another application setting.

VBA Code:
Sub FixFlickers()
    Application.Calculation = xlManual

    'your code here

    Application.Calculation = xlAutomatic
End Sub
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
20,054
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
Are you activating / selecting the worksheets to work on them ??
It may be a better option to use With... End With stements to work on the sheet without selecting it.
Maybe if you posted some code that we could look at that adjusts a sheet other than the "Macro" sheet.
 

Watch MrExcel Video

Forum statistics

Threads
1,128,122
Messages
5,628,822
Members
416,342
Latest member
BlueDevil12

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
Top