1
Experiment 3
Aim:
To understand macro and using its various features.
Materials Required
uired:
• A computer with Microsoft Excel installed.
Theory:
What are Macros?
Macros are feature of MS word that allows us to record our commands and
execute them anywhere and anytime.
Benefits of Using Macros
• Time-Saving: Automate routine tasks to save time.
• Consistency: Ensure that tasks are performed the same way every time.
• Complex Operations: Execute complex calculations ns and operations with
minimal user input.
Procedure:
Step 1: Opening a Document:
1. You can use a blank document or a previously used document a blank
document is preferred as to reduce complexity and avoid confusion.
Step 2: Recording a Macro
1. In the view option, click on macrostab.
2. Now click on record macro to record a macro.
2
Experiment 3
3. You can give your desired name to macro. (try
try to give a meaningful
name)
4. Click on pause recording to stop recording.
recording
Step 3: Running the Macro
1. Go to the view option given in the menu bar.
2. Then click on the macros option.
3. Click on view macros you will find list of macros recorded by you.
4. Click on the macro that you want to run and click on the runbutton
run your
macro will run.
Step 4: Editing the Macro (Optional)
1. In the macros tab, click on Macros.
2. Select your macro and click Editoption
option given in the side of the tab.
3
Experiment 3
3. This will open your macro in VBA editor.Now you can edit commands
given in macro.
4. Modify the code as needed and close the editor.
Step 5: Assigning a Macro to a Button
1. You can also assign a keyboard shortcut to the macro when recording it.
2. When giving name to macro go to the keyboard option and assign a
shortcut key by pressing that key and clicking on assign and press
newshortcut
close button.
3. Now you can use your macro by clicking on the shortcut key.
4
Experiment 3
Result:
After completing the assignment, you should be able to:
• Record, run, and edit macros in Excel.
• Understand the basic principles of VBA programming for enhancing
macros.
• Automate repetitive tasks effectively using the features provided by Excel
macros.