VBA for Excel Cheat Sheet
VBA for Excel Cheat Sheet
by guslong via 1345/cs/510/
VBA data types
Type
Description
Variant
any data type
Integer
(2 bytes) integer
Long
(4 bytes) integer
Single
(4 bytes) floating point
Double
(8 bytes) floating point
String
non-numeric data
Object
any object reference
Date
a date
Boolean
True / False
Byte
1-255
Cell selection
select a single cell Range("A1").Select
select a contiguous range Range("A1:G5").Select
select a non-contiguous range Range("A1:G5,J10:J15").Select
offset syntax (move from A1 to A2) Range("A1").Offset(1,0).Select
select down to first empty cell Range(Selection, Selection.End(xlDown)).Select
set a cell's value Range("A1").Value = i
deleting, moving, copying (VBA)
Delete entire row Rows("2").Delete
Delete entire column Columns("B").Delete
Copy / paste a range with destination Range("A1:B6").Copy Destination:=Range("A1")
Clear a range Range("D:D").Clear
Delete a worksheet Worksheets("Sheet2").Delete
Execute a formula calculation in a range Range("A1:A3").Formula = 2*2/6
Use RANGE to select single cells.
Cheatographer
guslong guslong/
Iterate through a selection
Dim cell As Range For Each cell In Selection ... Next cell
Control structures VBA
Do ... Until Loop
Do [Until condition] ... Loop
Do ... While Loop Do [While condition] ... Loop
For...Next Loop For counter = start To end [Step s] ... Next [counter]
"WITH" syntax
With Worksheets("Sheet1") .Rows .Columns ... End With
The "with" construction provides a shorthand way of accessing many properties and methods of the same object.
String functions
InStr ([start], "string", "wha t_to_find") StrConv("string", vbProper| Upper|LowerCase) Left ("string", x) Len ("string") Trim ("string")
Split("string", ",")
Val("string")
StrComp("strA", "strB", vbTextCompare)
Returns position of string within a string
converts string to proper |upper|lower case
Return specified
Return length of string
Trims string of leading and trailing spaces
Split string by delimiter e.g. comma
Return numerical part only
Compare two strings (0=true)
VBA information functions IsArray IsEmpty IsError IsMissing IsNumeric IsNull IsObject
Cheat Sheet
This cheat sheet was published on 13th August, 2012 and was last updated on 13th August, 2012.
Sponsor
FeedbackFair, increase your conversion rate today! Try it free!
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- microsoft excel manual administration and finance
- vba for excel cheat sheet
- microsoft excel for mac basic customguide
- excel vba macro excel training in mumbai
- ken s excel 2007 vba notes
- copy data from one sheet to another in excel vba
- vba guide morningstar excel add in
- excel macro record and vba editor
- periodic table of excel keyboard shortcuts excel y vba
- learn vba for excel
Related searches
- excel cheat sheet 2016 pdf
- free excel cheat sheet download
- vba excel cheat sheet pdf
- microsoft excel cheat sheet pdf
- excel cheat sheet printable
- vba for excel tutorial pdf
- cheat sheet for excel 2013
- excel cheat sheet pdf
- excel vba cheat sheet pdf
- vba for excel pdf textbook
- excel cheat sheet for beginners
- vba for excel pdf