Friday, January 11, 2008

Excel VBA commands

In this post, I will simply list a bunch of useful single (approximately) line VBA for Excel commands.

'Minimize the Excel Application.
'This does not work when a userform is open.
Application.WindowState = xlMinimized


'Get the active cell column as a number
Dim dblCurrentColumn As Double
dblCurrentColumn = Application.ActiveCell.Column


'Get the active cell row as a number
Dim dblCurrentRow As Double
dblCurrentRow = Application.ActiveCell.Column


'Declare an array. This example declares a 6 x 3 array.
Dim vntArray(0 To 5, 0 To 2) As Variant


'The general form is to declare an N x M array as:
Dim vntArray(0 To N-1, 0 to M-1).

No comments: