ME 142 Engineering Computation I Macros. Key Concepts Macro Overview Recording a Macro Running a...
-
Upload
vincent-barnett -
Category
Documents
-
view
244 -
download
4
Transcript of ME 142 Engineering Computation I Macros. Key Concepts Macro Overview Recording a Macro Running a...
Macro Overview
A macro is a short program or set of recorded keystrokes
Stored as VBA program Great for repetitive tasks Can be edited Great way to learn new VBA functions
Recording a Macro
Recording of a macros can be launched from the View and Developer tabs or the lower left of the spreadsheet window
Recording a Macro Prior to recording
the macro, a dialog box is displayed
Note in particular: Shortcut key Storage location
Ending a Macro Recording
Use the Stop Recording button on from the View or Developer tabs or the lower left of the spreadsheet window
Running a Macro
Click on Macro from the View or Developer ribbons to list available macros
May also use previously assigned shortcut key combination to launch macro
Editing a Macro
Edit a Macro as you would any VBA program
Alternately may launch editor by clicking on Macro in the View or Developer ribbons and selecting Edit
Example Problem Convert a temperature from F to C
Both F and C temperatures should appear in adjacent cells when the macro is complete
Using Controls Form Controls can be used to facilitiate
getting input or running a VBA program Example:
Button – facilitate running VBA program
Using Controls Continued
Forms controls can also be used in Excel spreadsheets and custom dialog boxes
Today we’ll look at their use directly in a spreadsheet
Later will see how they can be used in custom dialog boxes
Spin Button
Used to increase/decrease the value of a cell May link directly to a cell After placing control, right click to format
control
Scroll Bar
Used to increase/decrease the value of a cell May position either horizontally or vertically
by dragging in that direction After placing control, right click to format
control
ReviewQuestion
In Excel, a macro is always created as a:A. VBA Sub
B. VBA Function
C. VBA Macro
D. May be either A or B
E. None of the above