VBA for Modelers: Developing Decision Support Systems with Microsoft Office Excel
The "CP212 Midterm Preparation Guide" is a concise document designed to assist students in preparing for the "Windows Application Programming" course. It revolves around using VBA for Windows application development, with the main reference being the textbook "VBA for Modellers." The guide likely c...
Chapter 2:
● Subroutine (sub), a macro:
○ Programmers → subroutine/procedure
○ Spreadsheet users → macro
● Program → all subs in an application
● Sub → performs one specific task in the overall program
Excel object model:
● Objects → Properties (describe an object)→ methods → argument for
methods/events
To change the color of the active cell:
● ActiveCell.Interior.Color = 255 (VbRed)
,VBE Basics:
● IDE for programming with VBA on excel
● How to open it ?
○ Press Visual Basic OR Alt + F11
● Extensions:
○ Spreadsheets → xlsx
○ Macro → xlsm
● Features:
○ View TAB
○ Code Window
○ Project Explorer Window
■ Project (workbook)
● List of spreadsheets
■ Modules Folder
● List of modules
■ Forms
● List of user forms
○ Properties Window
■ Content depend on the selected object
○ Immediate Window
■ One-line VBA commands
○ Object Browser
● More Features:
○ Auto complete sub → end sub
○ Colors —> blue for keyword, red for syntax error, green for comments
○ Case INSENSITIVE
, Chapter 3:
● Macros:
○ Macros = procedure = subs
■ VBA codes that perform a set of actions
○ Loops & control logic → cannot be recorded
Recording Macros:
○ Developer Tab → record macros
○ Taskbar → left hand corner
● Toolbar:
● Saving → can be added to Quick access toolbar (QAT)
Drawbacks:
○ Recorded code is difficult to read
○ duplicate /create sheet → shows error
Chapter 5:
● Subroutines:
○ VBA set of code that performs a specific task
■ Sub → macro
○ Program contains multiple sub
○ Located → in module
■ VBE → insert → module
■ Sub name cannot contain space (camel case)
■ First sub → main sub
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller WilfridLaurier. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $7.99. You're not tied to anything after your purchase.