Exercises in VBA for Microsoft Excel.
Installation
- Try Microsoft 365 for free
- Download and install or reinstall Microsoft 365 or Office 2021 on a PC of Mac
- Update Office with Microsoft Update
- Get started with Excel
- Formulas and functions
- Import and analyze data
- Enter and format data
- Troubleshoot
- [ b ] Microsoft Excel. (22 Aug 2023). "Announcing Python in Excel: Combining the power of Python and the flexibility of Excel".
- [ b ] Anaconda. "The Versatility of Excel + The Power of Anaconda".
[ h ] Zurnstein, Felix. (2021). Python for Excel: A Modern Environment for Automation and Data Analysis. O'Reilly.
Language reference for Visual Basic for Applications (VBA)
Getting started with VBA in Office
Concepts (Excel VBA reference)
[ d ] VBA for Excel
- [ d ]
Range
object - [ d ]
Sheets
object - [ d ]
Style
object - [ d ]
Styles
object - [ d ]
WorksheetFunction.Match
method - [ d ]
Worksheet
objet- [ d ]
Worksheet.Name
property
- [ d ]
- [ d ]
Worksheets
object
data types
- [ d ] Currency
[ d ] Error messages
- [ d ]
Error 009
Subscript out of range - [ d ]
Error 013
Type mismatch - [ d ]
Error 450
Wrong number of arguments
- [ w ] Basic
- [ w ] Cell
- [ w ] Column Label
- [ w ] Conditional Formatting
- [ w ] Filter
- [ w ] Formula
- [ w ] Freeze
- [ w ] Function
- [ w ] Macro
- [ w ] Microsoft Excel
- [ w ] Microsoft Office
- [ w ] Module
- [ w ] Pane
- [ w ] Pivot Chart
- [ w ] Pivot Table
- [ w ] Row Index
- [ w ] Sheet
- [ w ] Spreadsheet
- [ w ] Subroutine
- [ w ] Tablular Data
- [ w ] VBScript
- [ w ] VB Visual Basic
- [ w ] VB .NET
- [ w ] VBA Visual Basic for Applications
- [ w ] Worksheet
.xlsx
Excel Workbook
.xlsm
Excel Workbook (macro-enabled)
Module (right-click > "Insert" > "Module")
- an organizational unit of VBA code that's usually attached to a workbook or worksheet
Specify cells of a spreadsheet
Cells(<row>, <col>)
numeric, coordinate-basedCells(1, 1)
designates row 1, col 1
Ranges
F5:F7
contiguousR2,D2
noncontiguous
.Value
clears
.Clear
.ClearContents
.ClearFormats
ActiveSheet.UsedRange.Delete
Sheets("Sheet1").Cells.Clear
Comments '
Variable Declaration
Dim <name> As <type>
Types
Double
Integer
String
Split
Cast
- int to string
Str()
- string to int
Int()
Arrays
- zero-indexed
Conditionals If
Then
End If
ElseIf
Else
And
Or
For
Each