Put A Calculation Into Excel to Keep Screen Screensaver Open
When working on complex Excel calculations that take time to complete, you may want to prevent your screen from going to sleep or turning off. This guide explains how to keep your screen active while working in Excel, including both general computer methods and Excel-specific techniques.
Why Keep Your Screen Open While Using Excel
There are several reasons why you might want to prevent your screen from going to sleep during Excel calculations:
- Long-running calculations may be interrupted by screen sleep
- You want to monitor progress without manual intervention
- You're working in a presentation or demonstration environment
- Your computer's power settings might not be optimal for your workflow
While Excel itself doesn't have a built-in feature to prevent screen sleep, there are several methods you can use to achieve this.
Methods to Keep Your Screen Open
1. Adjust Power Settings
The most straightforward method is to adjust your computer's power settings to prevent sleep:
- Open Control Panel > Power Options
- Click "Choose what the power buttons do"
- Click "Change settings that are currently unavailable"
- Set "Turn off the display" to "Never"
- Set "Put the computer to sleep" to "Never"
Note: These settings will remain in effect until you change them back. For temporary use, consider using the calculator below to automate screen wake.
2. Use Keyboard/Mouse Activity
Simply moving your mouse or pressing a key every few minutes will prevent sleep. This is the simplest method but requires manual intervention.
3. Use Third-Party Utilities
There are several third-party applications that can prevent sleep, such as Caffeine for macOS or KeepAwake for Windows. These tools often provide a simple toggle to enable/disable sleep prevention.
Excel-Specific Methods
1. VBA Macro to Prevent Sleep
You can create a simple VBA macro in Excel to prevent sleep during calculations:
To create this macro:
- Press Alt+F11 to open the VBA editor
- Insert a new module (Insert > Module)
- Paste the following code:
Sub PreventSleep() ' Prevent sleep during calculations Application.Wait Now + TimeValue("00:00:05") ' Add your calculation code here ' For example: Range("A1").Formula = "=SUM(B1:B100)" End Sub - Run the macro when needed
2. Excel Add-ins
Some Excel add-ins provide sleep prevention features. Look for add-ins that offer "presentation mode" or "focus mode" which often include screen sleep prevention.
Automating Screen Awake During Calculations
For more advanced users, you can automate screen wake during Excel calculations using Windows API calls or third-party tools. Here's a basic example using VBA:
This code uses Windows API to prevent sleep:
Private Declare PtrSafe Function SetThreadExecutionState Lib "kernel32" _
(ByVal esFlags As Long) As Long
Private Const ES_CONTINUOUS As Long = &H80000000
Private Const ES_SYSTEM_REQUIRED As Long = &H1
Private Const ES_DISPLAY_REQUIRED As Long = &H2
Sub PreventSleepDuringCalculation()
' Prevent sleep during calculation
Dim result As Long
result = SetThreadExecutionState(ES_CONTINUOUS Or ES_SYSTEM_REQUIRED Or ES_DISPLAY_REQUIRED)
' Your calculation code here
' For example: Range("A1").Formula = "=SUM(B1:B100)"
' Restore normal sleep behavior
result = SetThreadExecutionState(ES_CONTINUOUS)
End Sub
This method requires Windows and may need adjustments for different versions. Always test thoroughly before using in production environments.
Best Practices for Long Excel Sessions
In addition to preventing screen sleep, consider these best practices for long Excel sessions:
- Save your work frequently with automatic save features
- Use Excel's "Calculate" options to control when calculations occur
- Consider breaking large calculations into smaller batches
- Use Excel's "Enable iterative calculation" for complex models
- Monitor system resources during calculations
Warning: Some of these advanced techniques can significantly impact performance. Test thoroughly before applying to large workbooks.