08 Macros - Excel Macros CEE3804 Computer Applications for...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Excel Macros CEE3804 Computer Applications for Civil and Environmental Engineers
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Macros Definition z A macro is: z a series of commands recorded within the user interface and wrapped into a single action z A procedure is: z is a series of actions but, unlike macros, a procedure is written from scratch with the Visual Basic for Applications (VBA) programming language z In summary: z a series of commands is called a macro when it is recorded, however, a macro is a procedure within the VBA world
Background image of page 2
Macros Recording Macros z Recording macros: z Tools/Macros/Record New Macro z Macro recorder is impartial : should map out exactly what you are trying to do z overall goal of macro z cells that will be selected z data required by macro z menu command to accomplish task z workbooks that will use the macro z Give macro a descriptive name and shortcut z Indicate relative versus absolute references
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Macros Recording Macros z Recording macros: z Tools/Macros/Record New Macro z Macro recorder is impartial : should map out exactly what you are trying to do z overall goal of macro z cells that will be selected z data required by macro z menu command to accomplish task z workbooks that will use the macro z Give macro a descriptive name and shortcut z Indicate relative versus absolute references
Background image of page 4
Macros Example z Create a macro called “Title_Logo”: z Goes down one row and types the following title: Virginia Tech Civil and Environmental Engineering Department z Makes the text bold z Inserts the date in the cell below the title using the 04-Mar-00 format z Open the Visual Basic editor to view the code: z Tools/Macros/Visual Basic Editor or Alt+F11
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Macros Example Sub Title_Logo() ' ' Title_Logo Macro ' Macro recorded 2/7/02 ' Keyboard Shortcut: Ctrl + T ' ActiveCell.Offset(1, 0).Range("A1").Select ActiveCell.FormulaR1C1 = "Virginia Tech Department of Civil and Environmental Engineering" Selection.Font.Bold = True ActiveCell.Offset(1, 0).Range("A1").Select ActiveCell.FormulaR1C1 = "=TODAY()" Selection.NumberFormat = "dd-mmm-yy" End Sub
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/14/2008 for the course CEE 3804 taught by Professor Aatrani during the Fall '07 term at Virginia Tech.

Page1 / 23

08 Macros - Excel Macros CEE3804 Computer Applications for...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online