0% found this document useful (0 votes)
28 views14 pages

Assignment 20

Uploaded by

Vidit Goel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views14 pages

Assignment 20

Uploaded by

Vidit Goel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Macro Training

By- Vidit Goel


Enrollment number: 07514788823
Class 1 B
C
WHAT IS A MACRO

WHY SHOULD WE USE MACROS

WHEN WOULD WE USE IT? NOT USE IT?

CONTENTS
WHERE ARE WE ABLE TO ACCESS MACRO

USEFUL TIPS
What is
Macro
What is Maccro

·Excel is object based model …


·Objects include things such as
application, workbook, worksheet, cells
·Each object has properties Macros execute tasks according to
·Color, border, value, name instructions. Macros do not think…

.Everything you do can be expressed in code


(instructions);it is stored the same way.
·Each time you do anything in Excel the same action
can be expressed in code.
·You interact with excel through an interface
that makes the code easier to
understand/intuit.
·Choosing the "sheet1"sheet is expressed as;
Sheets("sheet1").Select
WHY WOULD
WE
USE IT ?
WHY WOULD WE USE IT ?

It saves time giving more time to work


on higher levels
Macro can do things more quickly
than you can.
It standardised processes eliminates
error due to deviation from
instructions
It will do the exact same thing each
time it runs
WHEN WOULD WE
USE IT?
NOT USE IT?
When would we use it?Not use it?

When you are doing a routine task that you can


write VERY
good instructions for doing you can likely automate
that task by using Macro.
We won't use it when abstract thinking or problem
solving is a necessary component of the task or
when there are any new variables present in our
current task.
WHERE ARE WE
ABLE TO
ACCESS MACRO
Where are we able to access a
macro?
1. Go to developer tab get access.
2. Record a macro button -in
Developer tab
3. Alt+F11 show the VBE;Visual Basic
Editor
4. Tour of Macro code area
5. Project tree object properties space
for code
USEFUL
TIPS
USEFUL TIPS
Macros run from wherever you call them if you call them on
the wrong sheet the result can be really bad

Use Sheets("sheet-name").Select to make sure it always


goes to the right sheet before you call it
Usage of message boxes to check code msg box"stop"

Problem:with filters being off and on and errors -they


need to be correct or you'll get errors
Problem:with sheets being hidden and referencing them for
actions

Error handling:
If it is possible that your code will generate an error you
don't want your code to stop running.Need to tell it to do so
b/c by default it stops.2 methods:
On Error Goto Next
On Error Goto 0
USEFUL TIPS

·Syntax in Macro and Excel is not the same.……Of course


·Use msg boxes to help see if your code is right
·More quotes are needed.

·Create a Ul with hiding sheets

· Create codes that show and hide sheets so that when an


action is taken
you go to a different part of a workbook.This
turns a workbook into an
application.

·Save before you run extremely hard to undo macros

·The best code never uses the "select"code!Each time this


happens it slows
THANKS

BY VIDIT GOEL
Enrollment number: 07514788823
Class 1 B

You might also like