Call us at:   1.805.498.7162     1.805.558.9277

Microsoft Excel training options for business, engineering and science Innovative Microsoft Excel software design View our customer list from our over 14 years in business Phone numbers, email address and contact form Learn about EMAGENIT Home page containing upcoming Microsoft Excel classes and other EMAGENIT services Self-study Microsoft Excel manuals for business, engineering and science Microsoft Excel consulting services Microsoft Excel training schedule and prices

Home > Excel Resources > What is a VBA Procedure, Sub Procedure, Function Procedure?

What is a VBA Procedure, Sub Procedure, Function Procedure?

What is a VBA Procedure, Sub Procedure, Function Procedure?

 
Specifics

 

 

What is a VBA Procedure?

  • The word Macro is slang for the word VBA procedure. It is a throw back to pre 1994 Microsoft Excel.

  • A procedure is defined as a named group of statements that are run as a unit.

    • A statement is simply 1 complete line of code.

  • VBA procedures are used to perform tasks such as controlling Excel’s environment, communicating with databases, calculating equations, analyzing worksheet data, creating charts…etc

  • A VBA procedure unit or block consists of a procedure statement (Sub or Function) and an ending statement with statements in between.

  • A VBA procedure is constructed from three types of statements: executable, declaration and assignment statements. The statements between a procedure’s declaration and ending statement (i.e. Sub and End Sub) perform the procedure's task; what you are trying do.

    • For example, the Sub procedure pictured below commands Excel's Sort feature on the active worksheet when it is run.

  • Procedures are typed and stored in a Module

  • Procedures are executed or run in order to carry out their statements. When a procedure is run, its statements (i.e. lines) are executed in a top-down line by line fashion performing operations. Think of reading a book page. Note that typing a procedure in a module does not run it. You must do this after typing it by variety of different methods. Until you run it, it is just basically text sitting in a document.

  • VBA has two basic types of procedures that you can create: Sub procedures and Function procedures.

 

Sub Procedures

  • Sub procedures are written when you want to command Excel like creating a chart, analyzing data, coloring cells, copying and pasting data...etc. A simple Sub procedure is pictured below.

VBA Sub Procedure

 

Function Procedures

  • Function procedures are created when you want to make your own custom worksheet functions or perform a calculation that will be used over and over again. Note that Sub procedures can also be used to do calculations. A simple function procedure is pictured below.

VBA Function Procedure

 

What VBA Procedure to Write

  • So if you want to do a task in Excel, you write a Sub procedure, if you want to write a custom worksheet function, you write a Function procedure. Are their grey areas between the two where they can do the same thing, yes, but do not worry about them when first starting out.

 

<<What is a VBA Module and How is It Used?                How is VBA Used?>>

Need Help Learning Excel VBA?

Let our Microsoft Excel VBA workshops below show you how to command Excel in ways you never thought possible. They are unlike anything taught on the training market today.

Free Workshop Repeats

Microsoft Excel Workshops -  Free RepeatsAll of our workshops come with free repeats. We understand learning takes time. Details

EMAGENIT Customers and Awards

EMAGENIT Customers and AwardsAt EMAGENIT, we have trained customers like:

  • Janus Capital, HSBC, Deutsche Bank, Google, Apple, BMW, Capital One and Disney (View More)

We have also trained organizations like ICE, NASA, The US Army, Navy, Air Force and Marines and develop custom Excel software for the likes of Caterpillar and NASA (Award). Our diverse training background and software projects ensure you get the best Excel training drawn from real world experience not academia.

Beginning Microsoft Excel VBA - Business

Beginning Microsoft Excel VBA WorkshopOur 2-day Excel VBA workshop shows you "hands-on" the basics of using VBA (macros) to command Excel, process and reconcile worksheet data, create charts, build pivot tables, build basic dashboards, command Word / PowerPoint and more. Complete Outline and Signup

Available: Public Seminar, Company Onsite, Live Webinar, Self-Study

Advanced Microsoft Excel VBA - Business

Advanced Microsoft Excel VBA Workshop - MacrosOur 3-day Excel VBA workshop shows you "hands-on" how to construct advanced dashboard and data analysis business tools in Excel. Discussed is multi file/folder processing, ActiveX controls, databases, userforms and advanced command of Excel including pivot tables and charts. It not only shows how to control Excel, it shows how to tie into other systems as well. Complete Outline and Signup

Available: Public Seminar, Company Onsite, Live Webinar, Self-Study

Beginning Microsoft Excel VBA - Engineering & Science

Beginning Microsoft Excel VBA Workshop - MacrosOur 2-day Excel VBA workshop shows you "hands-on" from an engineering & science perspective the basics of using VBA to command Excel, process and reconcile data, control worksheets and workbooks, control ranges, create charts, create functions, build powerful models, build dashboards and command Word and PowerPoint. Complete Outline and Signup

Available: Public Seminar, Onsite, Live Webinar, Self-Study

Advanced Microsoft Excel VBA  - Engineering & Science

Advanced Microsoft Excel VBA Workshop - MacrosOur 3-day Excel VBA workshop shows you "hands-on" from an engineering & science perspective how to create advanced data analysis tools, system models, database tools, dashboard tools and program integration tools using Excel VBA. Complete Outline and Signup

Available: Public Seminar, Company Onsite, Live Webinar, Self-Study

 

 

 

 

Site Map

Copyright © 2002-2013 EMAGENIT All Rights Reserved