- Basic Concepts
- VBA enables automation and manipulation of Excel workbooks using Visual Basic programming
- Developer tab must be enabled in Excel options
- Macros can be created using Visual Basic IDE with alt+F11 shortcut
- Range and Cells
- Range object defines rows and columns of cells
- Cells object provides coordinates for selecting cells
- Multiple cells can be selected using range or cell references
- Variables and Procedures
- Variables can be declared using Dim keyword
- Procedures can be called using Call keyword
- Variables can be public or private
- Control Structures
- Loops include For, Do, While, and For Each
- Conditional statements use If, Else, and Select Case
- Input boxes allow user data collection
- Events
- Worksheet events trigger when cells are selected or clicked
- Workbook events control when workbook opens, saves, or closes
- ActiveX forms provide extensive customization options
- Form Elements
- Checkboxes and option buttons allow user input
- Combo boxes and list boxes create dropdown menus
- User forms can be hidden and loaded dynamically