Course recordings on DaDesktop for Training platform
Visit NobleProg websites for related course
Visit outline: Visual Basic for Applications (VBA) for Analysts (Course code: 3164)
Summary
Overview
This course session focuses on teaching loop structures and input handling in a programming or automation environment (likely VB.NET or similar), with emphasis on using input boxes to collect user data and manipulating numeric offsets in column/row positioning. The instructor guides learners through debugging a column-offset issue caused by input handling, then transitions to practical exercises involving date calculations and age computation using built-in functions like Year() and CDate(). The session ends with a plan for follow-up practice.
Topic (Timeline)
1. Column Offset Issue with Input Boxes [00:00:03.880 - 00:07:45.040]
The instructor investigates a discrepancy where using an input box causes column positioning to shift by one unit. When a user inputs a number (e.g., 5), the system behaves as if the value is offset by -1 (e.g., starting at column 4 instead of 5). The instructor demonstrates this repeatedly using visual references to rows and columns, clarifying that the input value must be adjusted by subtracting one to align with expected behavior. A key point is made that the input value is dynamic (variable), while the offset logic (e.g., +1) is static and fixed in the formula. The confusion centers on why the input value requires -1 to correct the column alignment, and the instructor emphasizes understanding the difference between static and dynamic values within loops.
2. Loop Fundamentals and Practice Plan [00:07:47.920 - 00:10:40.220]
The instructor acknowledges the learner’s confusion and shifts focus to foundational knowledge: confirming understanding of loop constructs (for, do while, do until). The session pauses to schedule dedicated practice time for loops and input handling the following day. A clear learning objective is set: to build confidence in using loops with input boxes before advancing to more complex logic.
3. Age Calculation Using Input and Date Functions [00:10:40.220 - 00:17:51.240]
The instructor introduces a practical exercise: using an input box to collect a person’s birthdate, then calculating and displaying their age by comparing it to the current date. The learner is guided through using CDate() to convert the input string into a date object and Year() to extract the year component. The instructor demonstrates the workflow but admits unfamiliarity with CDate() and defers full implementation to the next session. The session ends with agreement to revisit the exercise, emphasizing the need to practice date manipulation and function usage.
4. Session Wrap-up and Next Steps [00:17:57.920 - 00:21:02.520]
The session concludes with repeated confirmations of the next meeting time (9:00 the following day) and a plan to continue practicing input handling, loops, and date functions. The instructor reinforces a supportive tone, encouraging the learner to not worry about incomplete understanding and to focus on hands-on practice.
Appendix
Key Principles
- Input box values often require offset correction (e.g., subtract 1) to align with zero- or one-based indexing in systems.
- Dynamic inputs (e.g., user-entered numbers) must be distinguished from static logic (e.g., fixed
+1in formulas). - Use
CDate()to convert string inputs resembling dates into actual date objects. - Use
Year()to extract the year component from a date for age calculations.
Tools Used
- Input Box (for user data collection)
- Message Box (for output display)
CDate()(string-to-date conversion)Year()(extract year from date)- Loop constructs (
for,do while,do until)
Common Pitfalls
- Assuming input values directly map to system indices without adjustment.
- Not converting string inputs to date objects before performing date arithmetic.
- Confusing static formula components with dynamic user inputs.
Practice Suggestions
- Build multiple variations of the age calculator using different input formats (e.g., DD/MM/YYYY, MM-DD-YYYY).
- Create a loop that prompts for multiple birthdays and calculates ages in batch.
- Experiment with column/row offsets in a grid system using input values and verify alignment with and without
-1adjustment.