Excel VBA examples

The below table contains links to topics regarding the use of the main classes in Excel: Range, Worksheet and Workbook. The image at the bottom shows how you get access to all code fragments for all classes in Excel - with Range » Set » Range » SpecialCells » Comments as an example showing code to be inserted and available description and F1 hyperlink to online help on this subject.

Set range variableDeclare and Set worksheetCreate a new workbook
Different ways to loop through a rangeCreate a new worksheetOpen a workbook
SpecialCells such as blank, lastcell and moreUsed range in worksheetSet Workbook variable
Working with range cellsProtect worksheetClose workbook
Select and loop columnsDelete worksheetProtect workbook
Hide rowsHide worksheetTest if there is an open workbook with certain name
Hide columnsActivate worksheet (versus Select)
Clear Content, Format, Comments and moreTest if a sheet exists with name

Other supported languages: Spanish, German, Portuguese and French.

Excel VBA in action