SlideShare a Scribd company logo
1 of 5
Yoda Learning Solutions. All Rights Reserved 
Writing macros
Yoda Learning Solutions. All Rights Reserved 
Define your task 
1. Define the task you wish to program. 
2. The overall task must be broken down into smaller tasks. 
3. The program consists of a set of instructions or code, 
which the computer will follow. 
4. The order in which you place these statements is very 
important.
Layout of procedures 
•The blue text represents the procedure starting and ending signatures. 
•The green text represents the narrative/comments for documentation purposes which 
are excluded from the procedure. 
•All procedures must have starting signature and ending signature. 
Yoda Learning Solutions. All Rights Reserved
Yoda Learning Solutions. All Rights Reserved 
Pseudo code 
 Write the program out in plain English to explain what is going to 
happen. 
sub formatting() 
bold 
italic 
underline 
end sub 
 Calling a procedure (formatting) 
sub start() 
select cells A2:A10 
formatting 
select cells B1:G1 
formatting 
end sub
Writing macros from scratch 
Pseudo Code 
 Sub january() 
 Select Sheet1 
 Select the cell A1 
 Type January 
 Select the cell A2 
 Type 100 
 End Sub 
Yoda Learning Solutions. All Rights Reserved 
VBA Code 
 Sub january() 
 Worksheets("Sheet1").Select 
 Range("A1").Select 
 ActiveCell.Value = "January" 
 Range(“A2”).Select 
 ActiveCell.Value = 100 
 End Sub

More Related Content

Viewers also liked

κόμικς: ξένοι καλλιτέχνες
κόμικς: ξένοι καλλιτέχνεςκόμικς: ξένοι καλλιτέχνες
κόμικς: ξένοι καλλιτέχνεςakoutelida
 
A visit to a Blind Home
A visit to a Blind HomeA visit to a Blind Home
A visit to a Blind Homebhaviparikh
 
Όθωνας-Αντιβασιλεία
Όθωνας-ΑντιβασιλείαΌθωνας-Αντιβασιλεία
Όθωνας-Αντιβασιλείαkonstantina valari
 
πολιτιστικο προγραμμα γυμνασιου αστακου 2015 (1)
πολιτιστικο προγραμμα γυμνασιου αστακου 2015 (1)πολιτιστικο προγραμμα γυμνασιου αστακου 2015 (1)
πολιτιστικο προγραμμα γυμνασιου αστακου 2015 (1)Vally Boura
 
Diethyl Ether (DEE) Process flow diagram
Diethyl Ether (DEE) Process flow diagramDiethyl Ether (DEE) Process flow diagram
Diethyl Ether (DEE) Process flow diagramPratik Patel
 
Training Pics(Advance Excel)
Training Pics(Advance Excel)Training Pics(Advance Excel)
Training Pics(Advance Excel)Ashfaq Ahmed
 
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 Delhiibinstitute0
 

Viewers also liked (13)

κόμικς: ξένοι καλλιτέχνες
κόμικς: ξένοι καλλιτέχνεςκόμικς: ξένοι καλλιτέχνες
κόμικς: ξένοι καλλιτέχνες
 
A visit to a Blind Home
A visit to a Blind HomeA visit to a Blind Home
A visit to a Blind Home
 
Medical billing monitor.
Medical billing monitor.Medical billing monitor.
Medical billing monitor.
 
Όθωνας-Αντιβασιλεία
Όθωνας-ΑντιβασιλείαΌθωνας-Αντιβασιλεία
Όθωνας-Αντιβασιλεία
 
πολιτιστικο προγραμμα γυμνασιου αστακου 2015 (1)
πολιτιστικο προγραμμα γυμνασιου αστακου 2015 (1)πολιτιστικο προγραμμα γυμνασιου αστακου 2015 (1)
πολιτιστικο προγραμμα γυμνασιου αστακου 2015 (1)
 
VBA - Macro For Ms.Excel
VBA - Macro For Ms.ExcelVBA - Macro For Ms.Excel
VBA - Macro For Ms.Excel
 
Diethyl Ether (DEE) Process flow diagram
Diethyl Ether (DEE) Process flow diagramDiethyl Ether (DEE) Process flow diagram
Diethyl Ether (DEE) Process flow diagram
 
Training Pics(Advance Excel)
Training Pics(Advance Excel)Training Pics(Advance Excel)
Training Pics(Advance Excel)
 
Bio gas
Bio gasBio gas
Bio gas
 
Bio gas plant
Bio gas plantBio gas plant
Bio gas plant
 
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
 
Enlace Ciudadano Nro. 242 - Presentación código penal.
Enlace Ciudadano Nro. 242 -  Presentación código penal.Enlace Ciudadano Nro. 242 -  Presentación código penal.
Enlace Ciudadano Nro. 242 - Presentación código penal.
 
Enlace Ciudadano Nro. 242 - La hora cantinflada
Enlace Ciudadano Nro. 242 - La hora cantinfladaEnlace Ciudadano Nro. 242 - La hora cantinflada
Enlace Ciudadano Nro. 242 - La hora cantinflada
 

Recently uploaded

Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...Americas Got Grants
 
Psychic Reading | Spiritual Guidance – Astro Ganesh Ji
Psychic Reading | Spiritual Guidance – Astro Ganesh JiPsychic Reading | Spiritual Guidance – Astro Ganesh Ji
Psychic Reading | Spiritual Guidance – Astro Ganesh Jiastral oracle
 
Technical Leaders - Working with the Management Team
Technical Leaders - Working with the Management TeamTechnical Leaders - Working with the Management Team
Technical Leaders - Working with the Management TeamArik Fletcher
 
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptx
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptxGo for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptx
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptxRakhi Bazaar
 
digital marketing , introduction of digital marketing
digital marketing , introduction of digital marketingdigital marketing , introduction of digital marketing
digital marketing , introduction of digital marketingrajputmeenakshi733
 
Strategic Project Finance Essentials: A Project Manager’s Guide to Financial ...
Strategic Project Finance Essentials: A Project Manager’s Guide to Financial ...Strategic Project Finance Essentials: A Project Manager’s Guide to Financial ...
Strategic Project Finance Essentials: A Project Manager’s Guide to Financial ...Aggregage
 
Guide Complete Set of Residential Architectural Drawings PDF
Guide Complete Set of Residential Architectural Drawings PDFGuide Complete Set of Residential Architectural Drawings PDF
Guide Complete Set of Residential Architectural Drawings PDFChandresh Chudasama
 
GUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdf
GUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdfGUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdf
GUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdfDanny Diep To
 
Types of Cyberattacks - ASG I.T. Consulting.pdf
Types of Cyberattacks - ASG I.T. Consulting.pdfTypes of Cyberattacks - ASG I.T. Consulting.pdf
Types of Cyberattacks - ASG I.T. Consulting.pdfASGITConsulting
 
Intermediate Accounting, Volume 2, 13th Canadian Edition by Donald E. Kieso t...
Intermediate Accounting, Volume 2, 13th Canadian Edition by Donald E. Kieso t...Intermediate Accounting, Volume 2, 13th Canadian Edition by Donald E. Kieso t...
Intermediate Accounting, Volume 2, 13th Canadian Edition by Donald E. Kieso t...ssuserf63bd7
 
Pitch Deck Teardown: Xpanceo's $40M Seed deck
Pitch Deck Teardown: Xpanceo's $40M Seed deckPitch Deck Teardown: Xpanceo's $40M Seed deck
Pitch Deck Teardown: Xpanceo's $40M Seed deckHajeJanKamps
 
Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...
Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...
Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...ssuserf63bd7
 
Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...Peter Ward
 
Cyber Security Training in Office Environment
Cyber Security Training in Office EnvironmentCyber Security Training in Office Environment
Cyber Security Training in Office Environmentelijahj01012
 
Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.Anamaria Contreras
 
20200128 Ethical by Design - Whitepaper.pdf
20200128 Ethical by Design - Whitepaper.pdf20200128 Ethical by Design - Whitepaper.pdf
20200128 Ethical by Design - Whitepaper.pdfChris Skinner
 
TriStar Gold Corporate Presentation - April 2024
TriStar Gold Corporate Presentation - April 2024TriStar Gold Corporate Presentation - April 2024
TriStar Gold Corporate Presentation - April 2024Adnet Communications
 
Driving Business Impact for PMs with Jon Harmer
Driving Business Impact for PMs with Jon HarmerDriving Business Impact for PMs with Jon Harmer
Driving Business Impact for PMs with Jon HarmerAggregage
 

Recently uploaded (20)

Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...
 
Psychic Reading | Spiritual Guidance – Astro Ganesh Ji
Psychic Reading | Spiritual Guidance – Astro Ganesh JiPsychic Reading | Spiritual Guidance – Astro Ganesh Ji
Psychic Reading | Spiritual Guidance – Astro Ganesh Ji
 
Technical Leaders - Working with the Management Team
Technical Leaders - Working with the Management TeamTechnical Leaders - Working with the Management Team
Technical Leaders - Working with the Management Team
 
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptx
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptxGo for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptx
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptx
 
digital marketing , introduction of digital marketing
digital marketing , introduction of digital marketingdigital marketing , introduction of digital marketing
digital marketing , introduction of digital marketing
 
Strategic Project Finance Essentials: A Project Manager’s Guide to Financial ...
Strategic Project Finance Essentials: A Project Manager’s Guide to Financial ...Strategic Project Finance Essentials: A Project Manager’s Guide to Financial ...
Strategic Project Finance Essentials: A Project Manager’s Guide to Financial ...
 
Guide Complete Set of Residential Architectural Drawings PDF
Guide Complete Set of Residential Architectural Drawings PDFGuide Complete Set of Residential Architectural Drawings PDF
Guide Complete Set of Residential Architectural Drawings PDF
 
WAM Corporate Presentation April 12 2024.pdf
WAM Corporate Presentation April 12 2024.pdfWAM Corporate Presentation April 12 2024.pdf
WAM Corporate Presentation April 12 2024.pdf
 
The Bizz Quiz-E-Summit-E-Cell-IITPatna.pptx
The Bizz Quiz-E-Summit-E-Cell-IITPatna.pptxThe Bizz Quiz-E-Summit-E-Cell-IITPatna.pptx
The Bizz Quiz-E-Summit-E-Cell-IITPatna.pptx
 
GUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdf
GUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdfGUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdf
GUIDELINES ON USEFUL FORMS IN FREIGHT FORWARDING (F) Danny Diep Toh MBA.pdf
 
Types of Cyberattacks - ASG I.T. Consulting.pdf
Types of Cyberattacks - ASG I.T. Consulting.pdfTypes of Cyberattacks - ASG I.T. Consulting.pdf
Types of Cyberattacks - ASG I.T. Consulting.pdf
 
Intermediate Accounting, Volume 2, 13th Canadian Edition by Donald E. Kieso t...
Intermediate Accounting, Volume 2, 13th Canadian Edition by Donald E. Kieso t...Intermediate Accounting, Volume 2, 13th Canadian Edition by Donald E. Kieso t...
Intermediate Accounting, Volume 2, 13th Canadian Edition by Donald E. Kieso t...
 
Pitch Deck Teardown: Xpanceo's $40M Seed deck
Pitch Deck Teardown: Xpanceo's $40M Seed deckPitch Deck Teardown: Xpanceo's $40M Seed deck
Pitch Deck Teardown: Xpanceo's $40M Seed deck
 
Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...
Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...
Horngren’s Financial & Managerial Accounting, 7th edition by Miller-Nobles so...
 
Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...
 
Cyber Security Training in Office Environment
Cyber Security Training in Office EnvironmentCyber Security Training in Office Environment
Cyber Security Training in Office Environment
 
Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.
 
20200128 Ethical by Design - Whitepaper.pdf
20200128 Ethical by Design - Whitepaper.pdf20200128 Ethical by Design - Whitepaper.pdf
20200128 Ethical by Design - Whitepaper.pdf
 
TriStar Gold Corporate Presentation - April 2024
TriStar Gold Corporate Presentation - April 2024TriStar Gold Corporate Presentation - April 2024
TriStar Gold Corporate Presentation - April 2024
 
Driving Business Impact for PMs with Jon Harmer
Driving Business Impact for PMs with Jon HarmerDriving Business Impact for PMs with Jon Harmer
Driving Business Impact for PMs with Jon Harmer
 

How to write a VBA macros script?

  • 1. Yoda Learning Solutions. All Rights Reserved Writing macros
  • 2. Yoda Learning Solutions. All Rights Reserved Define your task 1. Define the task you wish to program. 2. The overall task must be broken down into smaller tasks. 3. The program consists of a set of instructions or code, which the computer will follow. 4. The order in which you place these statements is very important.
  • 3. Layout of procedures •The blue text represents the procedure starting and ending signatures. •The green text represents the narrative/comments for documentation purposes which are excluded from the procedure. •All procedures must have starting signature and ending signature. Yoda Learning Solutions. All Rights Reserved
  • 4. Yoda Learning Solutions. All Rights Reserved Pseudo code  Write the program out in plain English to explain what is going to happen. sub formatting() bold italic underline end sub  Calling a procedure (formatting) sub start() select cells A2:A10 formatting select cells B1:G1 formatting end sub
  • 5. Writing macros from scratch Pseudo Code  Sub january()  Select Sheet1  Select the cell A1  Type January  Select the cell A2  Type 100  End Sub Yoda Learning Solutions. All Rights Reserved VBA Code  Sub january()  Worksheets("Sheet1").Select  Range("A1").Select  ActiveCell.Value = "January"  Range(“A2”).Select  ActiveCell.Value = 100  End Sub