Тёмный

Excel VBA Macro: Progress Bar While Macro is Running (UserForm) 

greggowaffles
Подписаться 6 тыс.
Просмотров 41 тыс.
50% 1

Excel VBA Macro: Progress Bar While Macro is Running (UserForm). In this video, we go over how to create a status bar that serves as a progress indicator for any users running your macro. The progress bar we make is created with a UserForm that updates as the macro continues to run. Each update shows an increase in bar width and percentage. We also briefly go over the importance of DoEvents and vbModeless
Data used in this video:
simplemaps.com/data/world-cities
Code (RU-vid doesn't allow brackets; so LT and GT are used for less than and greater than, respectively):
Sub delete_rows()
Dim count As Integer
Dim start As Integer
Dim i As Integer
count = ActiveSheet.Cells(Rows.count, "A").End(xlUp).row
i = 2
OpenStatusBar
Do While i LT= count
If Cells(i, 9) = "" Then
Rows(i).EntireRow.Delete
i = i - 1
End If
DoEvents
Call RunStatusBar(i, count)
i = i + 1
count = ActiveSheet.Cells(Rows.count, "A").End(xlUp).row
Loop
Unload StatusBar
End Sub
Sub OpenStatusBar()
With StatusBar
.Bar.Width = 0
.Frame.Caption = "0% Complete"
.Show vbModeless
End With
End Sub
Sub RunStatusBar(row As Integer, total As Integer)
With StatusBar
.Bar.Width = 246 * (row / total)
.Frame.Caption = Round((row / total) * 100, 0) & "% Complete"
End With
End Sub
#ExcelVBA #ExcelMacro

Опубликовано:

 

1 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 56   
@ajaz4sky
@ajaz4sky 24 дня назад
Great explanation, really understood everything pretty easily.. better than other tutorials on progressbar in vba
@greggowaffles
@greggowaffles 20 дней назад
Appreciate the feedback!
@DrunkenKnight71
@DrunkenKnight71 2 года назад
Thanks so much, I was getting quite frustrated as I found lots of examples online but not one explained exactly how to incorporate my macro; after watching your video it worked first time and is absolutely perfect!!!
@greggowaffles
@greggowaffles 2 года назад
Awesome! So glad to hear that!!
@Nutflash1978
@Nutflash1978 Год назад
Mate that looks so good, am definitely gonna use this technique on my macros going forward. Great video!
@greggowaffles
@greggowaffles Год назад
Thanks a lot!
@CollDott
@CollDott Год назад
Best tubewise in both structure and explaining after viewing all others!! Applause applause!! And no dll needed!!
@greggowaffles
@greggowaffles Год назад
Thank you so much!!
@CollDott
@CollDott Год назад
@@greggowaffles omg haven't we been busy!! 😆 What took you so long!! No doubt the best I tested almost them all including some I believe from india!! LoL,🤩 great job simply!!!
@greggowaffles
@greggowaffles Год назад
Lol I’ve been super busy at work!! I need to make more time for videos. From India? Nice!!! Thanks again!!
@Ericvl2102
@Ericvl2102 6 месяцев назад
Thank you very much. Simple and effective.
@GaelExcelFacil
@GaelExcelFacil 8 месяцев назад
Excelente, desde Perú un fuerte abrazo, con esto concluyo mi proyecto !
@dimanezhdanov3557
@dimanezhdanov3557 7 месяцев назад
super video! you helped a log. God bless you :)
@Kakarot_Son_Goku
@Kakarot_Son_Goku 3 года назад
Amazing, I am delighted!
@greggowaffles
@greggowaffles 3 года назад
Glad to hear that!!
@JanBolhuis
@JanBolhuis 2 года назад
Thank you. Great video.
@greggowaffles
@greggowaffles 2 года назад
No problem! Thank you
@letslearnexcel
@letslearnexcel 3 года назад
Great video. Thank you for sharing.
@greggowaffles
@greggowaffles 3 года назад
Thanks for watching!
@binxu2674
@binxu2674 2 года назад
excellent. Works perfectly. Thank you very much.
@greggowaffles
@greggowaffles 2 года назад
No problem. Thank you for watching!
@armotxa124
@armotxa124 3 года назад
Thanks for sharing 👍
@greggowaffles
@greggowaffles 3 года назад
😎👍
@shakhobiddinnakiev6767
@shakhobiddinnakiev6767 Год назад
Hey, man! Great job, thank you so much!
@greggowaffles
@greggowaffles Год назад
Appreciate the feedback! Thanks for watching!!
@shakhobiddinnakiev6767
@shakhobiddinnakiev6767 Год назад
@@greggowaffles I have just done and it worked perfectly!!!
@greggowaffles
@greggowaffles Год назад
😎😎
@TheTiph0n
@TheTiph0n 3 месяца назад
Awesome 👍🏽
@greggowaffles
@greggowaffles 2 месяца назад
Thanks for the visit!
@maocabezas
@maocabezas Год назад
Great video! Works perfectly for me. While I watched the first time, was wondering why you didn't dim row and total (I'm not a programmer). I tried on my code using the exact same code you share and the Sub RunStatusBar did not work, but it was just a matter of using the variables I've already used instead of row and total and worked perfectly. Thanks!
@Friend-z-Mania
@Friend-z-Mania Год назад
Great Video
@greggowaffles
@greggowaffles Год назад
Thanks!
@yiangli
@yiangli Год назад
Thank you so much
@greggowaffles
@greggowaffles Год назад
You are very welcome!
@mustafacetin9637
@mustafacetin9637 Год назад
It worked bro thanks :))))
@greggowaffles
@greggowaffles Год назад
Glad to hear that!! No prob 😎
@alializadeh8195
@alializadeh8195 2 года назад
مرسی
@panksimus
@panksimus 2 года назад
Thanks very much for the tutorial. I have a personal macro file where I have a code to give me a list of sheets' name. Since it's in my personal macro file, I can run that code in any active workbook and it'll give me the list of sheets' name in that workbook. Is it possible to create a progress bar for that code? Just like a global code, can there be a global progress bar which is attached to the code and will run on any workbook the moment I run the code?
@heglem
@heglem 3 года назад
I’ve been looking for this for a while.... amazing video! For my macro I have to track progress of several Queries refresh, is there a way to track that in vba? Thx
@greggowaffles
@greggowaffles 3 года назад
thanks! can you be more specific? im not quite sure what youre asking
@tonio909
@tonio909 2 года назад
@@greggowaffles I think he means - for example let's say you have a few external data connections that query a sharepoint list or another excel file. The WB has a button that triggers a refresh of the data queries, let's say just one in total for this case. Is there a way within visual basic to display the progress, or at least get a confirmation that the query has completed its refresh successfully?
@a.irfansyah8581
@a.irfansyah8581 2 года назад
I use for next in my code, where i place the "doevents" ?
@charlessteve1911
@charlessteve1911 Год назад
As i am new to the coding world i am facing some difficulties to place a progressbar while macro runs ( progressbar for add, delete, update and search from userform to sheet). could you please help me with that if i send you my file?
@fajarpradhana
@fajarpradhana 3 месяца назад
Is it possible to run the status bar in the video without looping command?
@aiden9060
@aiden9060 Год назад
Do you know the impact on computational time something like this has on the program?
@Nevir202
@Nevir202 Год назад
Ya, kinda wish he would have run it with and without the bar, on a long data set, just to see if it was appreciable. I'm currently running a macro that looks like it is headed towards a 45 minute completion time. That's slow enough that a status bar would be nice, hence why I am here, but not nice enough that I'd want one if it's going to turn it into an hour long completion lol
@elfuego970
@elfuego970 3 года назад
Why the "row" and "total" variables are not defined and the macro works? How the macro understands what they are standing for?
@greggowaffles
@greggowaffles 3 года назад
They are being defined when I write "row as Integer" and "total as Integer" at the top of the sub
@benfoldin21
@benfoldin21 3 года назад
Hey this is Awesome!! Could you possibly post the code? Thanks great videos.
@greggowaffles
@greggowaffles 3 года назад
Thanks a lot! I'm out of town and away from my code right now but I can send it when I get back on Wednesday
@junjor
@junjor 2 года назад
great code and video! thank you! but please post the code here!! that makes everything easier for all of us
@greggowaffles
@greggowaffles 2 года назад
thanks! your wish is my command!! just added the code to the description 😉 i'll make sure to add the code going forward and will go back and the code to my existing videos as well
@aliameer7938
@aliameer7938 3 года назад
Please sir I want this file
@greggowaffles
@greggowaffles 2 года назад
just added the code in the description
@jpjacoby
@jpjacoby Год назад
greggowaffles, you saved me with this ".Show vbModeless"!!! Thx a lot
@greggowaffles
@greggowaffles Год назад
No prob! So glad to hear that!!
Далее
How to make your Excel VBA code run 1000 times faster
16:55
Модные мальчишки
00:36
Просмотров 20 тыс.
When You Get Ran Over By A Car...
00:15
Просмотров 6 млн
Excel VBA Progress Bar on Userform
20:01
Просмотров 72 тыс.
Ultimate Progress Bar Control in VBA Userform
12:40
Просмотров 38 тыс.
Excel VBA how to create Progress Bar
6:47
Просмотров 3,6 тыс.
Excel Progress Bar Controlled by Checkboxes
7:24
Просмотров 64 тыс.
Progress bar while macro is running in Excel
4:13
Просмотров 12 тыс.
I Made this VBA Code 2,880,952% faster
12:21
Просмотров 24 тыс.
Модные мальчишки
00:36
Просмотров 20 тыс.