Well, the function is quite long, but you're looking at the function's entry point. The immediate window says True, then False, then True again as expected, but the code doesn't seem to have any effect on the application. If all of this happens, then you know it is working correctly. Net 2003 and Office 2010 Code: Excel Graphing | Excel Timer | Excel Tips and Tricks | Add controls in Office | Data tables in Excel | Gaussian random number distribution (VB6/VBA, VB.
Display Status Bar = True ''//Make sure that the statusbar is visible For i = 1 To i Max ''// imax is usually 30 or so fraction Done = CDbl(i) / CDbl(i Max) Application.Status Bar = Format(fraction Done, "0%") & " done..." ''// or, alternatively: ''// status Range.value = Format(fraction Done, "0%") & " done..." ''// Some code....... Display Status Bar = boo Status Bar State ''//Reset Status bar display setting Application.Status Bar = False ''//Return control of the Status bar to Excel Application.Screen Updating = True ''//Turn on screen updating End Sub Text boxes in worksheets are sometimes not updated when their text or formatting is changed, and even the Do Event command does not help.My Excel tool performs a long task, and I'm trying to be kind to the user by providing a progress report in the status bar, or in some cell in the sheet, as shown below.
But the screen doesn't refresh, or stops refreshing at some point (e.g. The task eventually completes but the progress bar is useless. For i=1 to imax ' imax is usually 30 or so fraction Done=cdbl(i)/cdbl(imax) Application.
Just one recalculation and one redraw at the end of your code execution is enough to get the workbook current with all your changes. Enable Events display Page Break State = Active Sheet. Since it requires lots of resources to draw the screen so frequently, just turn off drawing the screen until the end of your code execution.
Here’s some sample code that shows how and what to shut off while your code runs. Display Page Breaks ‘note this is a sheet-level setting ‘turn off some Excel functionality so your code runs faster Application. Be sure to turn it back on right before your code ends.
Screen Updating = false" because I saw the yellow highlight go over the line in debug mode. Calculation = xl Calculation Automatic Application. Screen Updating from within the code instead of the immediate window, but I'm fairly sure what I'll find. This function gets called by an event handler that catches a Commands Bar button event (? Basically, we create a menu bar and one of the buttons in our custom "File" menu is labeled "Load Portfolio" which calls this function. I have encountered the same symptoms and can't think as to why it's happening. I think that maybe something has broken in my excel because even when I closed out of excel and opened a brand new 2003 workbook with no previous code I was getting the same problem. The interesting thing is that *some* of my modules allow Screen Updating to be set to False, there's only a few that don't.
However, I *can* change the Screen Updating from the immediate window. Screen Updating = False b Global Change Event = True Application. About to go home for the day, but I plan on trying to print Application. So while Screen Updating always is True in debug mode, this is not the issue for me.
By setting Screen Updating to False at the Start of the macro, you will not only stop the constant screen flickering associated with recorded macro, but also greatly speed up the execution of the macro.