SlideShare una empresa de Scribd logo
1 de 18
Descargar para leer sin conexión
GETTING
STARTED
WITH EXCEL
MACROS –
DAY #1
Excel VBA
Tariq Al-Basha @ albashatariq@outlook.com 1
Key Topics
Tariq Al-Basha @ albashatariq@outlook.com 2
Getting Started with Excel Marcos
Using the Visual Basic Editor
VBA Programming Basics
Working with Excel Object Model
Using Variables & Arrays
Adding Control Statements
Using Built-in Functions & Statements
Debugging Macros
Key Topics
(Cont.)
Tariq Al-Basha @ albashatariq@outlook.com 3
Working with Other Workbooks & Files
Working with Other Worksheets
Defining Ranges
Working with Cells
Customizing Dialog, Boxes, Menus, & Toolbars
Working with Charts
Automating Procedures with Excel Events
AN
INTRODUCTION
TO MACROS
Tariq Al-Basha @ albashatariq@outlook.com 4
An Introduction To Marcos
Tariq Al-Basha @ albashatariq@outlook.com 5
Using Macros enables you to repeat tasks much more efficiently than tediously
performing each step over and over.
A macro is a set of instructions that you use to automate a task.
For example, if you want to take each column numbers, convert them to currency, and
then add them together, you can create a simple macro to perform this task.
The typical Excel user has a series of tasks that they perform frequently. By creating a
macro to perform those tasks, you only require a simple keystroke to repeat the tasks.
An Introduction To Marcos (Cont.)
Tariq Al-Basha @ albashatariq@outlook.com 6
You can create macros to perform a task as simple as adding two numbers, or as complex as
creating a whole user interface within Excel.
To do so, you can employ one, or a
combination, of two different methods:
You can use the Macro Recorder; or
You can manually write a macro using the Visual Basic Editor
Although many macros users rarely venture past the Macro Recorder, this presentation shows you
how to harness the power of Visual Basic for Applications, or VBA, to create more complex macros.
No matter how simple or complex a macro, you write them all using VBA.
An Introduction To Marcos (Cont.)
Tariq Al-Basha @ albashatariq@outlook.com 7
Macros are a term common to the spreadsheet world.
All spreadsheet packages on the market provide the ability to create Macros to automate tasks, and Excel is no
exception.
Although all Microsoft Office products provide the ability to create Macros, they are best suited for Microsoft Excel.
As an Excel user, you may have a series of tasks that you perform frequently. By creating a macro to perform
complex or repetitive tasks, you can save time by pressing a simple keystroke each time you want to perform the
tasks.
MACRO HISTORY
Tariq Al-Basha @ albashatariq@outlook.com 8
Marco & Lotus 1-2-3
■ Macros originated with Lotus 1-2-3 in a fashion similar to the
Macro Recorder you find in Excel today.
■ The lotus macros recorded the keystrokes and enable you to play
them later.
Tariq Al-Basha @ albashatariq@outlook.com 9
XLM Macro Sheets
■ Microsoft first entered the macro world with XLM macro sheets.
■ XLM macro sheets are just sheets of functions that Excel
evaluates in the sequence they exist within the selected macro.
■ Although, this macro language was powerful, it was difficult to use.
■ Excel still supports XLM macro sheets for compatibility with early
versions of Excel, it does not provide the ability to record an XLM
macro.
Tariq Al-Basha @ albashatariq@outlook.com 10
VBA Macros
■ The addition of Visual Basic for Applications (VBA) Macros
increased the popularity of Excel within the spreadsheet world.
■ Essentially, a subset of the popular Visual Basic language, VBA is
familiar to many developers.
■ VBA brings a much more powerful macro development platform to
Excel than the macro development environment in other
spreadsheet packages.
Tariq Al-Basha @ albashatariq@outlook.com 11
Excel Macros
■ Although Microsoft did not originate the concept of Macros and
spreadsheets, they have definitely built upon it.
■ The combination of the Macro Recorder and VBA makes macro
creation a powerful feature of Excel.
Tariq Al-Basha @ albashatariq@outlook.com 12
Macro Recorder
■ The Macro Recorder provides a great method for creating a macro without
writing VBA code directly.
■ The Macro Recorder holds true to its name. Just like tape recorder, when you
turn it on, it records all the events that occur with Excel.
■ Excel takes the recorded events and creates the VBA code necessary to
recreate the events.
■ You can modify all Macros you create with the Macro Recorder in the Visual
Basic Editor.
■ The Macro Recorder works well for creating simple Macros, such as a macro
that adds a column of numbers, or changes the layout of the page.
Tariq Al-Basha @ albashatariq@outlook.com 13
Macro Recorder (Cont.)
■ But due to the fact that the Macro Recorder creates a macro by recording your
actions, it cannot create a complex macro such as one that repeats a process
until meeting a specific condition or displays a custom dialog box.
■ More complex Excel Macros require the use of VBA.
■ The Marco Recorder does work well in conjunction with the Visual Basic Editor.
■ For example, if you want to create a macro that sums each column of data in
your worksheet, you record the macro that sums a column.
■ You then edit the macro in the Visual Basic Editor to run the macro until Excel
process all columns.
■ Combining the use of the Macro Recorder and the Visual Basic Editor
simplifies the macro creation by allowing Excel to code part of it for you.
Tariq Al-Basha @ albashatariq@outlook.com 14
Macro Storage
■ The Store macro option on the Macro dialog box instructs Excel where
to store the macros you record.
■ Excel provides three different storage locations for your Macros: (1)
the current workbook, (2) a new workbook, or (3) the Personal Macro
workbook.
■ You can store a recorded macro to your current workbook, commonly
referred to as to active workbook, by selecting the This Workbook
option. Use this option if you plan to share the workbook with other
users.
■ Storing the Macros in the active workbook makes Macros available to
any user who opens the workbook.
Tariq Al-Basha @ albashatariq@outlook.com 15
Macro Storage (Cont.)
■ You can record a macro to a New workbook.
■ Excel creates the workbook automatically and adds the new macro to
it.
■ If you store a macro in another workbook, you need to open that
workbook whenever you want to use that macro.
■ You store Macros in separate workbooks when you want to store
specific types of Macros in different workbooks.
■ For example, you may want to place all Macros that perform budget
calculations in one workbook.
■ You can record a global macro by selecting Personal Macro Workbook,
which serves as a common storage location for Macros that you
expect to use with other workbooks.
Tariq Al-Basha @ albashatariq@outlook.com 16
Macro Storage (Cont.)
■ Excel stores your personal Macro Workbook as Personal.xls in the
XlStrat folder.
■ This workbook does not exist until you store a macro in it.
■ After you create the workbook, it loads whenever you run Excel as a
hidden workbook.
■ Excel hides the Personal Macro workbook so that you are unaware of
it being open.
■ The Storage location you select for a macro depends on where you
want to access to the Macro.
■ If you create the macro with the Macro Recorder, you can select the
storage location of the macro when you create it on the Record Macro
Dialog box.
Tariq Al-Basha @ albashatariq@outlook.com 17
Next Presentation
■ The Next Presentation is about Recording a Macro…
Tariq Al-Basha @ albashatariq@outlook.com 18

Más contenido relacionado

Similar a Getting Started with Excel Macros – Day #1

0403-excel-macros-made-easy.pdf
0403-excel-macros-made-easy.pdf0403-excel-macros-made-easy.pdf
0403-excel-macros-made-easy.pdf
ABHISHEK MALIK
 
Intro macros in Excel 2007
Intro macros in Excel 2007Intro macros in Excel 2007
Intro macros in Excel 2007
Hasrudin Tazep
 

Similar a Getting Started with Excel Macros – Day #1 (20)

VBA
VBAVBA
VBA
 
ExcelMacros.pptx
ExcelMacros.pptxExcelMacros.pptx
ExcelMacros.pptx
 
Learn Excel Macro
Learn Excel Macro  Learn Excel Macro
Learn Excel Macro
 
MS-Excel
MS-ExcelMS-Excel
MS-Excel
 
Excel 2007 Unit I
Excel 2007 Unit IExcel 2007 Unit I
Excel 2007 Unit I
 
VT University Live Session 3
VT University Live Session 3VT University Live Session 3
VT University Live Session 3
 
ExcelMacros.pptx
ExcelMacros.pptxExcelMacros.pptx
ExcelMacros.pptx
 
MS Excel Macros/ VBA Project report
MS Excel Macros/ VBA Project reportMS Excel Macros/ VBA Project report
MS Excel Macros/ VBA Project report
 
0403-excel-macros-made-easy.pdf
0403-excel-macros-made-easy.pdf0403-excel-macros-made-easy.pdf
0403-excel-macros-made-easy.pdf
 
Online Advance Excel & VBA Training in India
 Online Advance Excel & VBA Training in India Online Advance Excel & VBA Training in India
Online Advance Excel & VBA Training in India
 
Introduction To Excel 2007 Macros
Introduction To Excel 2007 MacrosIntroduction To Excel 2007 Macros
Introduction To Excel 2007 Macros
 
Working with Excel Macros
Working with Excel MacrosWorking with Excel Macros
Working with Excel Macros
 
VBA
VBAVBA
VBA
 
Learn VBA Training & Advance Excel Courses in Delhi
Learn VBA Training & Advance Excel Courses in DelhiLearn VBA Training & Advance Excel Courses in Delhi
Learn VBA Training & Advance Excel Courses in Delhi
 
Intro macros in Excel 2007
Intro macros in Excel 2007Intro macros in Excel 2007
Intro macros in Excel 2007
 
Learn about excel
Learn about excelLearn about excel
Learn about excel
 
Vbabook ed2
Vbabook ed2Vbabook ed2
Vbabook ed2
 
TFI Leverage Excel 2007 (QAT) 011310
TFI Leverage Excel 2007 (QAT) 011310TFI Leverage Excel 2007 (QAT) 011310
TFI Leverage Excel 2007 (QAT) 011310
 
Excel - Group 1.pptx
Excel - Group 1.pptxExcel - Group 1.pptx
Excel - Group 1.pptx
 
Automating SolidWorks with Excel
Automating SolidWorks with ExcelAutomating SolidWorks with Excel
Automating SolidWorks with Excel
 

Más de Tariq Al-Basha

Más de Tariq Al-Basha (20)

The 48 Laws of Power - Law 38 - Think as you like, but behave like others
The 48 Laws of Power - Law 38 - Think as you like, but behave like othersThe 48 Laws of Power - Law 38 - Think as you like, but behave like others
The 48 Laws of Power - Law 38 - Think as you like, but behave like others
 
The 48 Laws of Power - Law 37 - Create Compelling Spectacles
The 48 Laws of Power - Law 37 - Create Compelling SpectaclesThe 48 Laws of Power - Law 37 - Create Compelling Spectacles
The 48 Laws of Power - Law 37 - Create Compelling Spectacles
 
The 48 Laws of Power - Law 36 - Disdain things you cannot have, Ignoring them...
The 48 Laws of Power - Law 36 - Disdain things you cannot have, Ignoring them...The 48 Laws of Power - Law 36 - Disdain things you cannot have, Ignoring them...
The 48 Laws of Power - Law 36 - Disdain things you cannot have, Ignoring them...
 
The 48 Laws of Power - Law 35 - Master the Art of Timing
The 48 Laws of Power - Law 35 - Master the Art of TimingThe 48 Laws of Power - Law 35 - Master the Art of Timing
The 48 Laws of Power - Law 35 - Master the Art of Timing
 
The 48 Laws of Power - Law 34 - Be Royal in Your Own Fashion – Act Like a Kin...
The 48 Laws of Power - Law 34 - Be Royal in Your Own Fashion – Act Like a Kin...The 48 Laws of Power - Law 34 - Be Royal in Your Own Fashion – Act Like a Kin...
The 48 Laws of Power - Law 34 - Be Royal in Your Own Fashion – Act Like a Kin...
 
The 48 Laws of Power - Law 33 - Discover Each Man’s Thumbscrew
The 48 Laws of Power - Law 33 - Discover Each Man’s ThumbscrewThe 48 Laws of Power - Law 33 - Discover Each Man’s Thumbscrew
The 48 Laws of Power - Law 33 - Discover Each Man’s Thumbscrew
 
الجملة وشبه الجملة
الجملة وشبه الجملةالجملة وشبه الجملة
الجملة وشبه الجملة
 
The 48 Laws of Power - Law 32 - Play to People’s Fantasies
The 48 Laws of Power - Law 32 - Play to People’s FantasiesThe 48 Laws of Power - Law 32 - Play to People’s Fantasies
The 48 Laws of Power - Law 32 - Play to People’s Fantasies
 
The 48 Laws of Power - Law 31 - Control the Options – Get others to Play with...
The 48 Laws of Power - Law 31 - Control the Options – Get others to Play with...The 48 Laws of Power - Law 31 - Control the Options – Get others to Play with...
The 48 Laws of Power - Law 31 - Control the Options – Get others to Play with...
 
أقسام الكلمة العربية
أقسام الكلمة العربيةأقسام الكلمة العربية
أقسام الكلمة العربية
 
The 48 Laws of Power - Law 30 - Make Your Accomplishments Seem Effortless
The 48 Laws of Power - Law 30 - Make Your Accomplishments Seem EffortlessThe 48 Laws of Power - Law 30 - Make Your Accomplishments Seem Effortless
The 48 Laws of Power - Law 30 - Make Your Accomplishments Seem Effortless
 
The 48 Laws of Power - Law 29 - Plan all the way to the End
The 48 Laws of Power - Law 29 - Plan all the way to the EndThe 48 Laws of Power - Law 29 - Plan all the way to the End
The 48 Laws of Power - Law 29 - Plan all the way to the End
 
The 48 Laws of Power - Law 28 - Enter Action with Boldness
The 48 Laws of Power - Law 28 - Enter Action with BoldnessThe 48 Laws of Power - Law 28 - Enter Action with Boldness
The 48 Laws of Power - Law 28 - Enter Action with Boldness
 
The 48 Laws of Power - Law 27 - Play on People’s Need to Believe to Create a ...
The 48 Laws of Power - Law 27 - Play on People’s Need to Believe to Create a ...The 48 Laws of Power - Law 27 - Play on People’s Need to Believe to Create a ...
The 48 Laws of Power - Law 27 - Play on People’s Need to Believe to Create a ...
 
The 48 Laws of Power - Law 26 - Keep Your Hands Clean
The 48 Laws of Power - Law 26 - Keep Your Hands CleanThe 48 Laws of Power - Law 26 - Keep Your Hands Clean
The 48 Laws of Power - Law 26 - Keep Your Hands Clean
 
The 48 Laws of Power - Law 25 - Recreate Yourself
The 48 Laws of Power - Law 25 - Recreate YourselfThe 48 Laws of Power - Law 25 - Recreate Yourself
The 48 Laws of Power - Law 25 - Recreate Yourself
 
The 48 Laws of Power - Law 24 - Play the Perfect Courtier
The 48 Laws of Power - Law 24 - Play the Perfect CourtierThe 48 Laws of Power - Law 24 - Play the Perfect Courtier
The 48 Laws of Power - Law 24 - Play the Perfect Courtier
 
The 48 Laws of Power - Law 23 - Concentrate Your Forces
The 48 Laws of Power - Law 23 - Concentrate Your ForcesThe 48 Laws of Power - Law 23 - Concentrate Your Forces
The 48 Laws of Power - Law 23 - Concentrate Your Forces
 
The 48 Laws of Power - Law 22 - Use the Surrender Tactic - Transform Weakness...
The 48 Laws of Power - Law 22 - Use the Surrender Tactic - Transform Weakness...The 48 Laws of Power - Law 22 - Use the Surrender Tactic - Transform Weakness...
The 48 Laws of Power - Law 22 - Use the Surrender Tactic - Transform Weakness...
 
The 48 Laws of Power - Law 21 - Play a Sucker to Catch a Sucker - Seem Dumber...
The 48 Laws of Power - Law 21 - Play a Sucker to Catch a Sucker - Seem Dumber...The 48 Laws of Power - Law 21 - Play a Sucker to Catch a Sucker - Seem Dumber...
The 48 Laws of Power - Law 21 - Play a Sucker to Catch a Sucker - Seem Dumber...
 

Último

➥🔝9953056974 🔝▻ Anand Vihar Call-girl in Women Seeking Men 🔝Delhi🔝 NCR
➥🔝9953056974 🔝▻ Anand Vihar Call-girl in Women Seeking Men 🔝Delhi🔝 NCR➥🔝9953056974 🔝▻ Anand Vihar Call-girl in Women Seeking Men 🔝Delhi🔝 NCR
➥🔝9953056974 🔝▻ Anand Vihar Call-girl in Women Seeking Men 🔝Delhi🔝 NCR
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls in Pakistan || 🥵 03280288848 || Pakistan Escorts
Call Girls in Pakistan || 🥵 03280288848 || Pakistan EscortsCall Girls in Pakistan || 🥵 03280288848 || Pakistan Escorts
Call Girls in Pakistan || 🥵 03280288848 || Pakistan Escorts
Ifra Zohaib
 
lahore night girls 👉03250114445 || girls for night in lahore
lahore night girls 👉03250114445 || girls for night in lahorelahore night girls 👉03250114445 || girls for night in lahore
lahore night girls 👉03250114445 || girls for night in lahore
Deny Daniel
 
Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7
Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7
Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7
Sana Rajpoot
 
Call Girls in Karachi || 03274100048 || 50+ Hot Sexy Girls Available 24/7
Call Girls in Karachi || 03274100048 || 50+ Hot Sexy Girls Available 24/7Call Girls in Karachi || 03274100048 || 50+ Hot Sexy Girls Available 24/7
Call Girls in Karachi || 03274100048 || 50+ Hot Sexy Girls Available 24/7
Sana Rajpoot
 
Call Girls in Sialkot || 🥵👙 || 03280288848
Call Girls in Sialkot || 🥵👙 || 03280288848Call Girls in Sialkot || 🥵👙 || 03280288848
Call Girls in Sialkot || 🥵👙 || 03280288848
Ifra Zohaib
 
Call Girls In Saidpur Islamabad-->>03274100048 <<--
Call Girls In Saidpur Islamabad-->>03274100048 <<--Call Girls In Saidpur Islamabad-->>03274100048 <<--
Call Girls In Saidpur Islamabad-->>03274100048 <<--
Ifra Zohaib
 

Último (20)

Rajkot Call Girls Contact Number +919358341802 Call Girls In Rajkot
Rajkot Call Girls Contact Number +919358341802 Call Girls In RajkotRajkot Call Girls Contact Number +919358341802 Call Girls In Rajkot
Rajkot Call Girls Contact Number +919358341802 Call Girls In Rajkot
 
Indore Call girl service 6289102337 indore escort service
Indore Call girl service 6289102337 indore escort serviceIndore Call girl service 6289102337 indore escort service
Indore Call girl service 6289102337 indore escort service
 
Silchar Call Girl 97487*63073 Call Girls in Silchar Escort service book now
Silchar Call Girl 97487*63073 Call Girls in Silchar Escort service book nowSilchar Call Girl 97487*63073 Call Girls in Silchar Escort service book now
Silchar Call Girl 97487*63073 Call Girls in Silchar Escort service book now
 
Mysore 💋 Call Girl 9748763073 Call Girls in Mysore Escort service book now
Mysore 💋 Call Girl 9748763073 Call Girls in Mysore Escort service book nowMysore 💋 Call Girl 9748763073 Call Girls in Mysore Escort service book now
Mysore 💋 Call Girl 9748763073 Call Girls in Mysore Escort service book now
 
➥🔝9953056974 🔝▻ Anand Vihar Call-girl in Women Seeking Men 🔝Delhi🔝 NCR
➥🔝9953056974 🔝▻ Anand Vihar Call-girl in Women Seeking Men 🔝Delhi🔝 NCR➥🔝9953056974 🔝▻ Anand Vihar Call-girl in Women Seeking Men 🔝Delhi🔝 NCR
➥🔝9953056974 🔝▻ Anand Vihar Call-girl in Women Seeking Men 🔝Delhi🔝 NCR
 
Call Girls in Pakistan || 🥵 03280288848 || Pakistan Escorts
Call Girls in Pakistan || 🥵 03280288848 || Pakistan EscortsCall Girls in Pakistan || 🥵 03280288848 || Pakistan Escorts
Call Girls in Pakistan || 🥵 03280288848 || Pakistan Escorts
 
lahore night girls 👉03250114445 || girls for night in lahore
lahore night girls 👉03250114445 || girls for night in lahorelahore night girls 👉03250114445 || girls for night in lahore
lahore night girls 👉03250114445 || girls for night in lahore
 
Raipur ❣️ Call Girl 97487*63073 Call Girls in Raipur Escort service book now
Raipur  ❣️ Call Girl 97487*63073 Call Girls in Raipur Escort service book nowRaipur  ❣️ Call Girl 97487*63073 Call Girls in Raipur Escort service book now
Raipur ❣️ Call Girl 97487*63073 Call Girls in Raipur Escort service book now
 
Kolkata 💋 Call Girl 9748763073 Call Girls in Kolkata Escort service book now
Kolkata 💋 Call Girl 9748763073 Call Girls in Kolkata Escort service book nowKolkata 💋 Call Girl 9748763073 Call Girls in Kolkata Escort service book now
Kolkata 💋 Call Girl 9748763073 Call Girls in Kolkata Escort service book now
 
Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7
Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7
Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7
 
Call Girls in Karachi || 03274100048 || 50+ Hot Sexy Girls Available 24/7
Call Girls in Karachi || 03274100048 || 50+ Hot Sexy Girls Available 24/7Call Girls in Karachi || 03274100048 || 50+ Hot Sexy Girls Available 24/7
Call Girls in Karachi || 03274100048 || 50+ Hot Sexy Girls Available 24/7
 
Varanasi Call Girl 78709*93772 Call Girls in Varanasi Escort service book now
Varanasi  Call Girl 78709*93772 Call Girls in Varanasi Escort service book nowVaranasi  Call Girl 78709*93772 Call Girls in Varanasi Escort service book now
Varanasi Call Girl 78709*93772 Call Girls in Varanasi Escort service book now
 
Berhampur Call Girl 97487*63073 Call Girls in Berhampur Escort service book now
Berhampur  Call Girl 97487*63073 Call Girls in Berhampur Escort service book nowBerhampur  Call Girl 97487*63073 Call Girls in Berhampur Escort service book now
Berhampur Call Girl 97487*63073 Call Girls in Berhampur Escort service book now
 
Hyderabad ❣️ Call Girl 9748763073 Call Girls in Hyderabad Escort service boo...
Hyderabad ❣️  Call Girl 9748763073 Call Girls in Hyderabad Escort service boo...Hyderabad ❣️  Call Girl 9748763073 Call Girls in Hyderabad Escort service boo...
Hyderabad ❣️ Call Girl 9748763073 Call Girls in Hyderabad Escort service boo...
 
Call Girls in Sialkot || 🥵👙 || 03280288848
Call Girls in Sialkot || 🥵👙 || 03280288848Call Girls in Sialkot || 🥵👙 || 03280288848
Call Girls in Sialkot || 🥵👙 || 03280288848
 
Guwahati ❣️ Call Girl 97487*63073 Call Girls in Guwahati Escort service book now
Guwahati ❣️ Call Girl 97487*63073 Call Girls in Guwahati Escort service book nowGuwahati ❣️ Call Girl 97487*63073 Call Girls in Guwahati Escort service book now
Guwahati ❣️ Call Girl 97487*63073 Call Girls in Guwahati Escort service book now
 
Lucknow ❣️ Call Girl 97487*63073 Call Girls in Lucknow Escort service book now
Lucknow ❣️  Call Girl 97487*63073 Call Girls in Lucknow Escort service book nowLucknow ❣️  Call Girl 97487*63073 Call Girls in Lucknow Escort service book now
Lucknow ❣️ Call Girl 97487*63073 Call Girls in Lucknow Escort service book now
 
Call Girls In Saidpur Islamabad-->>03274100048 <<--
Call Girls In Saidpur Islamabad-->>03274100048 <<--Call Girls In Saidpur Islamabad-->>03274100048 <<--
Call Girls In Saidpur Islamabad-->>03274100048 <<--
 
Vip profile Call Girls In Hyderabad 9748763073 For Genuine Sex Service At Jus...
Vip profile Call Girls In Hyderabad 9748763073 For Genuine Sex Service At Jus...Vip profile Call Girls In Hyderabad 9748763073 For Genuine Sex Service At Jus...
Vip profile Call Girls In Hyderabad 9748763073 For Genuine Sex Service At Jus...
 
Hire 💕 8617370543 Uttara Kannada Call Girls Service Call Girls Agency
Hire 💕 8617370543 Uttara Kannada Call Girls Service Call Girls AgencyHire 💕 8617370543 Uttara Kannada Call Girls Service Call Girls Agency
Hire 💕 8617370543 Uttara Kannada Call Girls Service Call Girls Agency
 

Getting Started with Excel Macros – Day #1

  • 1. GETTING STARTED WITH EXCEL MACROS – DAY #1 Excel VBA Tariq Al-Basha @ albashatariq@outlook.com 1
  • 2. Key Topics Tariq Al-Basha @ albashatariq@outlook.com 2 Getting Started with Excel Marcos Using the Visual Basic Editor VBA Programming Basics Working with Excel Object Model Using Variables & Arrays Adding Control Statements Using Built-in Functions & Statements Debugging Macros
  • 3. Key Topics (Cont.) Tariq Al-Basha @ albashatariq@outlook.com 3 Working with Other Workbooks & Files Working with Other Worksheets Defining Ranges Working with Cells Customizing Dialog, Boxes, Menus, & Toolbars Working with Charts Automating Procedures with Excel Events
  • 4. AN INTRODUCTION TO MACROS Tariq Al-Basha @ albashatariq@outlook.com 4
  • 5. An Introduction To Marcos Tariq Al-Basha @ albashatariq@outlook.com 5 Using Macros enables you to repeat tasks much more efficiently than tediously performing each step over and over. A macro is a set of instructions that you use to automate a task. For example, if you want to take each column numbers, convert them to currency, and then add them together, you can create a simple macro to perform this task. The typical Excel user has a series of tasks that they perform frequently. By creating a macro to perform those tasks, you only require a simple keystroke to repeat the tasks.
  • 6. An Introduction To Marcos (Cont.) Tariq Al-Basha @ albashatariq@outlook.com 6 You can create macros to perform a task as simple as adding two numbers, or as complex as creating a whole user interface within Excel. To do so, you can employ one, or a combination, of two different methods: You can use the Macro Recorder; or You can manually write a macro using the Visual Basic Editor Although many macros users rarely venture past the Macro Recorder, this presentation shows you how to harness the power of Visual Basic for Applications, or VBA, to create more complex macros. No matter how simple or complex a macro, you write them all using VBA.
  • 7. An Introduction To Marcos (Cont.) Tariq Al-Basha @ albashatariq@outlook.com 7 Macros are a term common to the spreadsheet world. All spreadsheet packages on the market provide the ability to create Macros to automate tasks, and Excel is no exception. Although all Microsoft Office products provide the ability to create Macros, they are best suited for Microsoft Excel. As an Excel user, you may have a series of tasks that you perform frequently. By creating a macro to perform complex or repetitive tasks, you can save time by pressing a simple keystroke each time you want to perform the tasks.
  • 8. MACRO HISTORY Tariq Al-Basha @ albashatariq@outlook.com 8
  • 9. Marco & Lotus 1-2-3 ■ Macros originated with Lotus 1-2-3 in a fashion similar to the Macro Recorder you find in Excel today. ■ The lotus macros recorded the keystrokes and enable you to play them later. Tariq Al-Basha @ albashatariq@outlook.com 9
  • 10. XLM Macro Sheets ■ Microsoft first entered the macro world with XLM macro sheets. ■ XLM macro sheets are just sheets of functions that Excel evaluates in the sequence they exist within the selected macro. ■ Although, this macro language was powerful, it was difficult to use. ■ Excel still supports XLM macro sheets for compatibility with early versions of Excel, it does not provide the ability to record an XLM macro. Tariq Al-Basha @ albashatariq@outlook.com 10
  • 11. VBA Macros ■ The addition of Visual Basic for Applications (VBA) Macros increased the popularity of Excel within the spreadsheet world. ■ Essentially, a subset of the popular Visual Basic language, VBA is familiar to many developers. ■ VBA brings a much more powerful macro development platform to Excel than the macro development environment in other spreadsheet packages. Tariq Al-Basha @ albashatariq@outlook.com 11
  • 12. Excel Macros ■ Although Microsoft did not originate the concept of Macros and spreadsheets, they have definitely built upon it. ■ The combination of the Macro Recorder and VBA makes macro creation a powerful feature of Excel. Tariq Al-Basha @ albashatariq@outlook.com 12
  • 13. Macro Recorder ■ The Macro Recorder provides a great method for creating a macro without writing VBA code directly. ■ The Macro Recorder holds true to its name. Just like tape recorder, when you turn it on, it records all the events that occur with Excel. ■ Excel takes the recorded events and creates the VBA code necessary to recreate the events. ■ You can modify all Macros you create with the Macro Recorder in the Visual Basic Editor. ■ The Macro Recorder works well for creating simple Macros, such as a macro that adds a column of numbers, or changes the layout of the page. Tariq Al-Basha @ albashatariq@outlook.com 13
  • 14. Macro Recorder (Cont.) ■ But due to the fact that the Macro Recorder creates a macro by recording your actions, it cannot create a complex macro such as one that repeats a process until meeting a specific condition or displays a custom dialog box. ■ More complex Excel Macros require the use of VBA. ■ The Marco Recorder does work well in conjunction with the Visual Basic Editor. ■ For example, if you want to create a macro that sums each column of data in your worksheet, you record the macro that sums a column. ■ You then edit the macro in the Visual Basic Editor to run the macro until Excel process all columns. ■ Combining the use of the Macro Recorder and the Visual Basic Editor simplifies the macro creation by allowing Excel to code part of it for you. Tariq Al-Basha @ albashatariq@outlook.com 14
  • 15. Macro Storage ■ The Store macro option on the Macro dialog box instructs Excel where to store the macros you record. ■ Excel provides three different storage locations for your Macros: (1) the current workbook, (2) a new workbook, or (3) the Personal Macro workbook. ■ You can store a recorded macro to your current workbook, commonly referred to as to active workbook, by selecting the This Workbook option. Use this option if you plan to share the workbook with other users. ■ Storing the Macros in the active workbook makes Macros available to any user who opens the workbook. Tariq Al-Basha @ albashatariq@outlook.com 15
  • 16. Macro Storage (Cont.) ■ You can record a macro to a New workbook. ■ Excel creates the workbook automatically and adds the new macro to it. ■ If you store a macro in another workbook, you need to open that workbook whenever you want to use that macro. ■ You store Macros in separate workbooks when you want to store specific types of Macros in different workbooks. ■ For example, you may want to place all Macros that perform budget calculations in one workbook. ■ You can record a global macro by selecting Personal Macro Workbook, which serves as a common storage location for Macros that you expect to use with other workbooks. Tariq Al-Basha @ albashatariq@outlook.com 16
  • 17. Macro Storage (Cont.) ■ Excel stores your personal Macro Workbook as Personal.xls in the XlStrat folder. ■ This workbook does not exist until you store a macro in it. ■ After you create the workbook, it loads whenever you run Excel as a hidden workbook. ■ Excel hides the Personal Macro workbook so that you are unaware of it being open. ■ The Storage location you select for a macro depends on where you want to access to the Macro. ■ If you create the macro with the Macro Recorder, you can select the storage location of the macro when you create it on the Record Macro Dialog box. Tariq Al-Basha @ albashatariq@outlook.com 17
  • 18. Next Presentation ■ The Next Presentation is about Recording a Macro… Tariq Al-Basha @ albashatariq@outlook.com 18