How to Master VBA loops FAST (with real coding examples)
ฝัง
- เผยแพร่เมื่อ 4 ต.ค. 2024
- Learn how to write real-world Excel VBA code: 👉courses.excelm...
Subscribe to the channel here: bit.ly/36hpTCY
How to Master VBA loops FAST (with real coding examples)
VBA has 4 types of loops and one of these loops can be written in 4 ways. This leads to a lot of confusion. In this video
I am going to show you exactly what each loop is for and when to use it and which loops you can avoid
#ExcelVBALoops #VBADoUntil #VBADoWhile
Useful VBA Shortcut Keys
========================
Debugging:
Compile the code: Alt + D + L OR Alt + D + Enter
Run the code from the current sub: F5
Step into the code line by line: F8
Add a breakpoint to pause the code: F9(or click left margin)
Windows:
View the Immediate Window: Ctrl + G
View the Watch Window: Alt + V + H
View the Properties Window: F4
Switch between Excel and the VBA Editor: Alt + F11
View the Project Explorer Window: Ctrl + R
Writing Code:
Search keyword under cursor: Ctrl + F3
Repeat last search: F3
Autocomplete word: Ctrl + Space
Get the definition of the item under the cursor: Shift + F2
Go to the last cursor position: Ctrl + Shift + F2
Get the current region on a worksheet: Ctrl + Shift + 8(or Ctrl + *)
To move lines of code to the right(Indent): Tab
To move lines of code to the left(Outdent): Shift + Tab
Delete a Line: Ctrl + Y(note: this clears the clipboard)
FLASH SALE: 25% off my Effective Excel VBA course before Saturday 14th September: 👉courses.excelmacromastery.com/courses/Effective_Excel_VBA
Learn how to write real-world Excel VBA code: 👉courses.excelmacromastery.com/
I am great at deciphering others code and tweaking to suit my needs, I couldn't write a loop to save my life. Looking forward to this tutorial. Thanks
Excellent and simple way explain. Post more advance vba like Update and changed in google sheet using excel vba.
I learned about the Do Loop because I wanted to exit the loop early under some conditions. It's done with Exit Do. The While loop doesn't have anything like that to break the loop.
Yes, the Do loop is more flexible.
Great video. Thank you Paul!
Thank heaps paul. Can you please put online nested dictionary tuto, i have tried it well based on your videos on dictionary, but want to improve it at the best
Please, Mr. Paul, we would like you to go into depth on the concepts of object-oriented programming in VBA with applied projects.
Nice Opinion :) Personally only ever used For or Do until.
I got tired of loops, so I ended up switching to GoTo statements which are much easier to use and understand without all that finicky syntax.
Nice
Thanks Suhu🙏🙏
Glad you like it.
Very useful information about looo tq sir 😊
You're Welcome
Great sir ❤
Hello, so i have a lot of pdf urls to download, probably like 1000. How can i download the bulk all at once? like i wanna put all 1000 url in sheet & click 1 button to download it all, is that possible? since do it manually would take ages. Also the i need to login (username & password) first so i can have access to the pdf urls, can u help? thanks so much!
Hi very off topic question, do you know how some accounting softwares have vba developed that can create reports and export data to excel. My question is how do they do that? Where do I begin to learn how to do this? Thanks.
Don’t loop, vectorise!
Do you have a VBA example?
that was great thank you, however am its giving me error 400 once using do while in this code: "Do while sheet2.cells(R,4)"" "". where is the error in this. will very much appreciate your feedback.
Hi Paul, as usual, again a great video from your side!😊 Thanks a lot for your work!🦾😉
Many thanks John