Show Menu
Cheatography

Excel VBA Cheat Sheet (DRAFT) by

Excell VBA common ops

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Data types

Type
Descri­ption
Variant
Any data type
Boolean
True / False
Byte, Integer, Long
Integers (Signed )
Single, Double
Floating point
String
String
Object
Any object reference
Date
Date & Hour
Array(10, 20, 30)
Array of 3 integers
Set dict = New Dictionary
Dictio­nnary (must reference Microsoft Scripting Runtime)
 

Control structures

Condit­ionnal Loop (While & Until)
Do While|­Until condition
...
Loop
For Loop
For counter = start To end [Step s]
...
Next counter
ForEach Loop
For Each element In collection
...
Next element
If-The­n-Else
If condition Then
...
Else:
...
End If
Operators
= (equals), <> (differs), <, >, <=, >=, And, Or, Not
 

Main objects

Applic­ation
Excel app
ThisWo­rkbook
Xls file containing the current macro
Active­Wor­kbook
Xls file with focus
Worksheets
Collection of sheets in the Workbook
Active­Sheet
Sheet with focus
Selection
Anything selected (often a range of cells)