{"id":12130,"date":"2012-02-29T13:46:40","date_gmt":"2012-02-29T13:46:40","guid":{"rendered":"http:\/\/www.learnexcelmacro.com\/?p=1394"},"modified":"2022-08-07T00:35:38","modified_gmt":"2022-08-07T00:35:38","slug":"progressbar-in-excel-vba","status":"publish","type":"post","link":"https:\/\/vmlogger.com\/excel\/2012\/02\/progressbar-in-excel-vba\/","title":{"rendered":"Progress Bar in Excel VBA"},"content":{"rendered":"
Progress bar is nothing but a placeholder, where you see the Progress of the operation which is getting performed.
\nLike Visual Studio there is NO already built progress bar in Excel Macro (VBA), which you can use it as an object and it will act like a Progress bar. But this is not a difficult task to create a Progress Bar in Excel Macro. In this article you are going to learn how to create\/simulate different types of Progress bar in Excel macro (VBA).
\nBasically as part of this article we are going to discuss following different kind of Progress bar:<\/p>\n
I believe this is the simplest way to show user the progress of your Excel Macro. For displaying and coding, both purposes it is very easy to use. Below is the Syntax to show the Progress of your Macro in Status Bar: <\/p>\n The above code will display the Dynamic Progress in % while Macro is running as shown below. Message you can customize yourself by changing the above Code.
\n
\nApplication.StatusBar=<Your Message or Status here<\/i>><\/font>
\n
\nExample:<\/strong> Below is an example, which shows how to show Progress message in Status Bar of the Excel, when Macro is running.<\/p>\n\r\n\r\nSub ShowProgressInStatus()\r\n\tDim Percent As Integer\r\n\tDim PercentComplete As Single\r\n\tDim MaxRow, MaxCol As Integer\r\n\tMaxRow = 800\r\n\tMaxCol = 800\r\n\tPercent = 0\r\n\tFor irow = 1 To MaxRow\r\n\t\tFor icol = 1 To MaxCol\r\n\t\t\tWorksheets(\"Sheet1\").Cells(irow, icol).Value = irow\r\n\t\tNext\r\n\t\tPercentComplete = irow * icol \/ (MaxRow * MaxCol)\r\n\t\tApplication.StatusBar = Format(PercentComplete, \"0%\") & \" Completed\"\r\n\t\tDoEvents\r\n\tNext\r\n\tApplication.StatusBar = \"\"\r\nEnd Sub\r\n\r\n<\/code><\/pre>\n
\n
\n