Range For repeat = 1 To 30 For Each cell In r cell. Value Mod 2 = 0) Then ' if i is even, color the cell white cell. Range For repeat = 1 To 30 For Each cell In r cell. Value Mod 2 = 0) Then ' if i is even, color the cell white cell.
Excel will default save it to your add-ins directory.
Screen Updating = True End Sub Activating another worksheet and then again activating the required worksheet worked for me - I had a code where the screen updating failed, I activated another worksheet and then again the one I was working on, it updated the current screen. Screen Updating = False ''''''code''''''' Thisworkbook.worksheets(any otherworksheet in workbook).activate Thisworkbook.worksheets(current worksheet).activate application.
Long-running, high-end Excel-based applications that I developed years ago and that run beautifully in Excel 20 look like Amateur Hour in Excel 20 because Application. The screen unfreezes apparently when VBA code copies a preformatted worksheet from the macro workbook into a new workbook, although other circumstances must trigger it as well.
Whenever you have a task to automate, you can usually go down the VBA route. Maybe later you add some features here-and-there, making your VBA code more powerful. Color = vb White End If i = i 1 Next cell ' offset i to alternate column coloring i = i 1 Next repeat Msg Box "Total time was: " & (Timer - start Time) End Sub Before moving on, let’s get a better understanding of why this is taking so long. Color = vb White End If i = i 1 Next cell ' offset i to alternate column coloring i = i 1 Next repeat Msg Box "Total time was: " & (Timer - start Time) Application.
And usually when you write your code, you’re just trying to get things to work. But after a while you notice your code is beginning to get very slow when it runs. I mentioned that the issue is that the screen is constantly updating, which is causing the code to run slowly. The code runs much faster when there’s less real estate to update on your screen. Screen Updating = True End Sub Now the code runs at 1.4 seconds for me, which is a huge improvement.