ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable user interaction in VBA (https://www.excelbanter.com/excel-programming/438681-disable-user-interaction-vba.html)

Labkhand

Disable user interaction in VBA
 
Hi All,

How can you disable user interaction with a workbook while awaiting
completion of running of a few macros? These macros depend on specific
selection of worksheets and if users change the worksheet tabs, they will
break the macros. How can I disable their user interaction with workbook
while macros are running?

I tried the followings which failed:
- changing the cursor shape to xlwait
- Application.ScreenUpdating = False
Application.EnableEvents = False

thanks for your help.

Bernie Deitrick

Disable user interaction in VBA
 
Write your macro code to be independent of selection:

Instead of

Worksheets("Sheet1").Select
Range("A12").Select
MyVal = Selection.Value

use

MyVal = Worksheets("Sheet1").Range("A12").Value

Post your code if you need help doing so.

HTH,
Bernie
MS Excel MVP


"LABKHAND" wrote in message
...
Hi All,

How can you disable user interaction with a workbook while awaiting
completion of running of a few macros? These macros depend on specific
selection of worksheets and if users change the worksheet tabs, they will
break the macros. How can I disable their user interaction with workbook
while macros are running?

I tried the followings which failed:
- changing the cursor shape to xlwait
- Application.ScreenUpdating = False
Application.EnableEvents = False

thanks for your help.





All times are GMT +1. The time now is 01:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com