Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/heracliteanflux/exercises-vba

Exercises in Visual Basic for Microsoft Excel.
https://github.com/heracliteanflux/exercises-vba

excel git-lfs vba vba-excel

Last synced: 22 days ago
JSON representation

Exercises in Visual Basic for Microsoft Excel.

Awesome Lists containing this project

README

        

# Excel & VBA

Exercises in VBA for Microsoft Excel.

## Excel

### Documentation

Installation
* [Try Microsoft 365 for free](https://www.microsoft.com/en-us/microsoft-365/try)
* [Download and install or reinstall Microsoft 365 or Office 2021 on a PC of Mac](https://support.microsoft.com/en-us/office/download-and-install-or-reinstall-microsoft-365-or-office-2021-on-a-pc-or-mac-4414eaaf-0478-48be-9c42-23adc4716658)
* [Update Office with Microsoft Update](https://support.microsoft.com/en-us/office/update-office-with-microsoft-update-f59d3f9d-bd5d-4d3b-a08e-1dd659cf5282)

[Excel help & learning](https://support.microsoft.com/en-us/excel)
* [Get started with Excel](https://support.microsoft.com/en-us/office/Get-started-with-Excel-f3937fb3-0a80-4b75-b45b-cffff35c19fa)
* [Save a workbook in another file format](https://support.microsoft.com/en-us/office/save-a-workbook-in-another-file-format-6a16c862-4a36-48f9-a300-c2ca0065286e)
* [File formats that are supported in Excel](https://support.microsoft.com/en-us/office/file-formats-that-are-supported-in-excel-0943ff2c-6014-4e8d-aaea-b83d51d46247)
* [Formulas and functions](https://support.microsoft.com/en-us/office/formulas-and-functions-294d9486-b332-48ed-b489-abe7d0f9eda9)
* Functions
* [AVERAGE](https://support.microsoft.com/en-us/office/average-function-047bac88-d466-426c-a32b-8f33eb960cf6)
* [COUNTIFS](https://support.microsoft.com/en-us/office/countifs-function-dda3dc6e-f74e-4aee-88bc-aa8c2a866842)
* [DATE](https://support.microsoft.com/en-us/office/date-function-e36c0c8c-4104-49da-ab83-82328b832349)
* [FILTER](https://support.microsoft.com/en-us/office/filter-function-f4f7cb66-82eb-4767-8f7c-4877ad80c759)
* [IFERROR](https://support.microsoft.com/en-us/office/iferror-function-c526fd07-caeb-47b8-8bb6-63f3e417f611)
* [MEDIAN](https://support.microsoft.com/en-us/office/median-function-d0916313-4753-414c-8537-ce85bdd967d2)
* [QUARTILE.EXC](https://support.microsoft.com/en-us/office/quartile-exc-function-5a355b7a-840b-4a01-b0f1-f538c2864cad)
* [ROUND](https://support.microsoft.com/en-us/office/round-function-c018c5d8-40fb-4053-90b1-b3e7f61a213c)
* [STDEV](https://support.microsoft.com/en-us/office/stdev-function-51fecaaa-231e-4bbb-9230-33650a72c9b0)
* [STDEV.P](https://support.microsoft.com/en-us/office/stdev-p-function-6e917c05-31a0-496f-ade7-4f4e7462f285)
* [STDEV.S](https://support.microsoft.com/en-us/office/stdev-s-function-7d69cf97-0c1f-4acf-be27-f3e83904cc23)
* [SUM](https://support.microsoft.com/en-us/office/sum-function-043e1c7d-7726-4e80-8f32-07b23e057f89)
* [VLOOKUP](https://support.microsoft.com/en-us/office/vlookup-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1)
* [YEAR](https://support.microsoft.com/en-us/office/year-function-c64f017a-1354-490d-981f-578e8ec8d3b9)
* More functions
* [Round a number](https://support.microsoft.com/en-us/office/round-a-number-f82b440b-689d-4221-b21e-38da99d33435)
* [Import and analyze data](https://support.microsoft.com/en-us/office/import-and-analyze-data-ccd3c4a6-272f-4c97-afbb-d3f27407fcde)
* [Import data](https://support.microsoft.com/en-us/office/import-and-analyze-data-ccd3c4a6-272f-4c97-afbb-d3f27407fcde#ID0EBBD=Import_data)
* [Tables](https://support.microsoft.com/en-us/office/import-and-analyze-data-ccd3c4a6-272f-4c97-afbb-d3f27407fcde#ID0EBBD=Tables)
* [Sort data in a table](https://support.microsoft.com/en-us/office/sort-data-in-a-table-77b781bf-5074-41b0-897a-dc37d4515f27)
* [Sort and filter](https://support.microsoft.com/en-us/office/import-and-analyze-data-ccd3c4a6-272f-4c97-afbb-d3f27407fcde#ID0EBBD=Sort_and_filter)
* [Filter data in a range or table](https://support.microsoft.com/en-us/office/filter-data-in-a-range-or-table-01832226-31b5-4568-8806-38c37dcc180e)
* [Charts](https://support.microsoft.com/en-us/office/import-and-analyze-data-ccd3c4a6-272f-4c97-afbb-d3f27407fcde#ID0EBBD=Charts)
* [PivotTables](https://support.microsoft.com/en-us/office/import-and-analyze-data-ccd3c4a6-272f-4c97-afbb-d3f27407fcde#ID0EBBD=PivotTables)
* [Create a PivotTable to analyze worksheet data](https://support.microsoft.com/en-us/office/create-a-pivottable-to-analyze-worksheet-data-a9a84538-bfe9-40a9-a8e9-f99134456576)
* [Calculate values in a PivotTable](https://support.microsoft.com/en-us/office/calculate-values-in-a-pivottable-11f41417-da80-435c-a5c6-b0185e59da77)
* [Change the source data for a PivotTable](https://support.microsoft.com/en-us/office/change-the-source-data-for-a-pivottable-afd93524-f7de-432c-84d0-3896fbbc2577)
* [Create dynamic charts by using PivotCharts](https://support.microsoft.com/en-us/office/create-a-pivotchart-c1b1e057-6990-4c38-b52b-8255538e7b1c)
* [Filter data in a PivotTable](https://support.microsoft.com/en-us/office/filter-data-in-a-pivottable-cc1ed287-3a97-4e95-b377-ddfafe79fa8f)
* [Group or ungroup data in a PivotTable](https://support.microsoft.com/en-us/office/group-or-ungroup-data-in-a-pivottable-c9d1ddd0-6580-47d1-82bc-c84a5a340725)
* [Data models](https://support.microsoft.com/en-us/office/import-and-analyze-data-ccd3c4a6-272f-4c97-afbb-d3f27407fcde#ID0EBBD=Data_models)
* [Enter and format data](https://support.microsoft.com/en-us/office/enter-and-format-data-fef13169-0a84-4b92-a5ab-d856b0d7c1f7)
* Format
* [Use conditional formatting to highlight information](https://support.microsoft.com/en-us/office/use-conditional-formatting-to-highlight-information-fed60dfa-1d3f-4e13-9ecb-f1951ff89d7f)
* [Highlight patterns and trends with conditional formatting](https://support.microsoft.com/en-us/office/highlight-patterns-and-trends-with-conditional-formatting-eea152f5-2a7d-4c1a-a2da-c5f893adb621)
* Layout
* [Freeze panes to lock rows and columns](https://support.microsoft.com/en-us/office/freeze-panes-to-lock-rows-and-columns-dab2ffc9-020d-4026-8121-67dd25f2508f)
* [Freeze columns and rows in Excel](https://support.microsoft.com/en-us/topic/freeze-columns-and-rows-in-excel-e7d1fcd9-7a67-94c2-e75b-cf54cc34bb1a)
* [Troubleshoot](https://support.microsoft.com/en-us/office/troubleshooting-and-support-278f4691-6e1d-445a-a048-a7968a047e55)
* [Repairing a corrupted workbook](https://support.microsoft.com/en-us/office/repairing-a-corrupted-workbook-7abfc44d-e9bf-4896-8899-bd10ef4d61ab)
* [Fixes or workarounds for recent issues in Excel for Windows](https://support.microsoft.com/en-us/office/fixes-or-workarounds-for-recent-issues-in-excel-for-windows-49d932ce-0240-49cf-94df-1587d9d97093)

[colors](http://dmcritchie.mvps.org/excel/colors.htm)

## Excel & Python

[ [d](https://support.microsoft.com/en-us/office/getting-started-with-python-in-excel-a33fbcbe-065b-41d3-82cf-23d05397f53d) ][ [g](https://github.com/microsoft/python-in-excel) ] Python in Excel
* [ [b](https://techcommunity.microsoft.com/t5/excel-blog/announcing-python-in-excel-combining-the-power-of-python-and-the/ba-p/3893439) ] Microsoft Excel. (22 Aug 2023). "Announcing Python in Excel: Combining the power of Python and the flexibility of Excel".
* [ [b](https://www.anaconda.com/excel) ] Anaconda. "The Versatility of Excel + The Power of Anaconda".

[ [h](https://www.xlwings.org/book) ] Zurnstein, Felix. (2021). _Python for Excel: A Modern Environment for Automation and Data Analysis_. O'Reilly.

## VBA

### Documentation

[Language reference for Visual Basic for Applications (VBA)](https://learn.microsoft.com/en-us/office/vba/api/overview/language-reference)
* [Visual Basic conceptual topics](https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/visual-basic-conceptual-topics)
* [Declaring arrays](https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/declaring-arrays)
* [Declaring constants](https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/declaring-constants)
* [Declaring variables](https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/declaring-variables)
* [Looping through code](https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/looping-through-code)
* [Using For...Next statements](https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/using-fornext-statements)

[Getting started with VBA in Office](https://learn.microsoft.com/en-us/office/vba/library-reference/concepts/getting-started-with-vba-in-office)

[Concepts (Excel VBA reference)](https://learn.microsoft.com/en-us/office/vba/excel/concepts/miscellaneous/concepts-excel-vba-reference)
* [Programming for the Single Document Interface in Excel](https://learn.microsoft.com/en-us/office/vba/excel/concepts/programming-for-the-single-document-interface-in-excel)

[ [d](https://learn.microsoft.com/en-us/office/vba/api/overview/excel) ] VBA for Excel
* [ [d](https://learn.microsoft.com/en-us/office/vba/api/excel.range(object)) ] `Range` object
* [ [d](https://learn.microsoft.com/en-us/office/vba/api/excel.range.autofit) ] `Range.AutoFit` method
* [ [d](https://learn.microsoft.com/en-us/office/vba/api/excel.range.count) ] `Range.Count` property
* [ [d](https://learn.microsoft.com/en-us/office/vba/api/excel.range.end) ] `Range.End` property
* [ [d](https://learn.microsoft.com/en-us/office/vba/api/excel.range.numberformat) ] `Range.NumberFormat` property
* [ [d](https://support.microsoft.com/en-us/office/number-format-codes-5026bbd6-04bc-48cd-bf33-80f18b4eae68?ui=en-us&rs=en-us&ad=us) ] Number format codes
* [ [d](https://learn.microsoft.com/en-us/office/vba/api/excel.range.numberformatlocal) ] `Range.NumberFormatLocal` property
* [ [d](https://learn.microsoft.com/en-us/office/vba/api/excel.range.row) ] `Range.Row` property
* [ [d](https://learn.microsoft.com/en-us/office/vba/api/excel.range.style) ] `Range.Style` property
* [ [d](https://learn.microsoft.com/en-us/office/vba/api/excel.sheets) ] `Sheets` object
* [ [d](https://learn.microsoft.com/en-us/office/vba/api/excel.style) ] `Style` object
* [ [d](https://learn.microsoft.com/en-us/office/vba/api/excel.styles) ] `Styles` object
* [ [d](https://learn.microsoft.com/en-us/office/vba/api/excel.worksheetfunction.match) ] `WorksheetFunction.Match` method
* [ [d](https://learn.microsoft.com/en-us/office/vba/api/excel.worksheet) ] `Worksheet` objet
* [ [d](https://learn.microsoft.com/en-us/office/vba/api/excel.worksheet.name) ] `Worksheet.Name` property
* [ [d](https://learn.microsoft.com/en-us/office/vba/api/excel.worksheets) ] `Worksheets` object

data types
* [ [d](https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/currency-data-type) ] Currency

[ [d](https://learn.microsoft.com/en-us/office/vba/language/reference/error-messages) ] Error messages
* [ [d](https://learn.microsoft.com/en-us/office/vba/Language/Reference/User-Interface-Help/subscript-out-of-range-error-9) ] `Error 009` Subscript out of range
* [ [d](https://learn.microsoft.com/en-us/office/vba/Language/Reference/User-Interface-Help/type-mismatch-error-13) ] `Error 013` Type mismatch
* [ [d](https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/wrong-number-of-arguments-error-450?f1url=%3FappId%3DDev11IDEF1%26l%3Den-US%26k%3Dk(vblr6.chm1000450)%3Bk(TargetFrameworkMoniker-Office.Version%3Dv16)%26rd%3Dtrue) ] `Error 450` Wrong number of arguments

## Terms

* [ [w](https://en.wikipedia.org/wiki/BASIC) ] Basic
* [ w ] Cell
* [ w ] Column Label
* [ w ] Conditional Formatting
* [ w ] Filter
* [ w ] Formula
* [ w ] Freeze
* [ w ] Function
* [ [w](https://en.wikipedia.org/wiki/Macro_(computer_science)) ] Macro
* [ [w](https://en.wikipedia.org/wiki/Microsoft_Excel) ] Microsoft Excel
* [ [w](https://en.wikipedia.org/wiki/Microsoft_Office) ] Microsoft Office
* [ w ] Module
* [ w ] Pane
* [ w ] Pivot Chart
* [ [w](https://en.wikipedia.org/wiki/Pivot_table) ] Pivot Table
* [ w ] Row Index
* [ w ] Sheet
* [ [w](https://en.wikipedia.org/wiki/Spreadsheet) ] Spreadsheet
* [ w ] Subroutine
* [ [w](https://en.wikipedia.org/wiki/Table_(information)) ] Tablular Data
* [ [w](https://en.wikipedia.org/wiki/VBScript) ] VBScript
* [ [w](https://en.wikipedia.org/wiki/Visual_Basic_(classic)) ] VB Visual Basic
* [ [w](https://en.wikipedia.org/wiki/Visual_Basic_.NET) ] VB .NET
* [ [w](https://en.wikipedia.org/wiki/Visual_Basic_for_Applications) ] VBA Visual Basic for Applications
* [ w ] Worksheet

## Notes

`.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(, )` numeric, coordinate-based
* `Cells(1, 1)` designates row 1, col 1
* `Ranges`
* `F5:F7` contiguous
* `R2,D2` noncontiguous
* `.Value`

clears
* `.Clear`
* `.ClearContents`
* `.ClearFormats`
* `ActiveSheet.UsedRange.Delete`
* `Sheets("Sheet1").Cells.Clear`

Comments `'`

Variable Declaration
`Dim As `

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`