Excel Visual Basic 365 Part 38– Loops

3 years ago
138

Loops will provide the ability to repeat operations in order to perform necessary repetitive tasks. This will allow you to search for information on a sheet, identify what is present, and evaluate data in order to make a decision. The FOR Loop will run for a specific set of times and you must determine upfront the number of cells before manipulating them. The DO Loop is better suited for cell manipulation because you can loop until you find a blank record.

Video Series Part 38- This is a comprehensive guide to learning Excel from the basics to advanced programming techniques. These videos are labeled in order beginning with Part 1, 2, 3, 4, etc. Each video can be downloaded and freely distributed to anyone desiring to learn Excel in great depth.
Higher Quality Video: www.elearnlogic.com/media/excel365-5-ch8.mp4

- Click + Rumble if the video was helpful.
- Click Subscribe so you won’t miss out on any new videos.
- Click the Share button so you can help others expand their skills.

Each video provides a great overview of the concepts, but the courseware provides additional details for a better understanding. You will be able to follow along with the courseware while watching this video.

Courseware: Excel 365 – Visual Basic For Excel
The courseware is available on Amazon at: https://www.amazon.com/dp/1979929076

Chapter 8 - Loop Control Structures
Loops will provide the ability to repeat operations in order to perform necessary repetitive tasks. This will allow you to search for information on a sheet, identify what is present, and evaluate data in order to make a decision. The FOR Loop will run for a specific set of times and you must determine upfront the number of cells before manipulating them. The DO Loop is better suited for cell manipulation because you can loop until you find a blank record.

Section 1 - For Loops
The FOR Loop is used for looping through an explicit number, counting until it reaches the end. In order to loop through cells or an Array you will need to extract the exact number of intervals desired. Once you have the counter number, you can loop through it either forward, backward, or skip every other number. The following concepts will be covered: For Next Loop, Loop Counter, Debug.Print, Step by 2, Count Backward, and Looping Over.

Section 2 - Do Loops
DO Loops are probably the best loop style when dealing with cell manipulation. The looping will be open-ended until it meets a specific condition. You can place the Until or While parameter either after the DO statement or at the ending statement LOOP. An Exit DO statement can be placed anywhere in the middle of the DO Loop to break or exit out at any time. The following concepts will be covered: Do Loop, Do While Loop, and Do Until.

Section 3 - Do While
You can use a DO While Loop to process the cells while a certain condition is present. However, when a condition changes it will stop. An Exit DO statement can be placed anywhere in the middle of the DO Loop to break or exit out at any time. The following concepts will be covered: Do While 1, Do While 2, and Do Exit Do.

Section 4 - While Wend Loops
A While Wend Loop structure is similar to a DO Loop. When the condition is True, the Macro Loops. When the condition is False, the Loop stops. This technique is not often used, however, it is important to know the format of this function in case it is in the existing code.

This Courseware/Video is based on Excel 365 and documents command differences between Excel 2010, Excel 2013, Excel 2016, and Excel 2019.

If you have any questions, please contact: Jeff Hutchinson, Website: http://www.elearnlogic.com, Email: jeffhutch@elearnlogic.com

Loading comments...