Printer Friendly
The Free Library
14,558,366 articles and books
Member login
User name  
Password 
 
Join us Forgot password?

Automate Excel functions: easy-to-create macros can take over many manual processes.


Macros, those do--it--yourself software programs, rank among Microsoft's most useful tools. They automate many computer tasks that you otherwise would have to execute manually--from the simple task of creating customized worksheets to the very complex tasks of exporting journal entries in Excel into an accounting package and creating reports in Word.

What makes macros so wonderful is that in many cases you don't have to be an expert to set them up. If you're willing to invest a little time to learn the language they are written in, Visual Basic (VB), you can make them perform some astonishingly a·ston·ish  
tr.v. as·ton·ished, as·ton·ish·ing, as·ton·ish·es
To fill with sudden wonder or amazement. See Synonyms at surprise.
 complicated jobs-such as handling an entire monthly close. For this article we will focus on macro basics that do not require you to program in VB. But be forewarned, once you see how powerful macros are, you may find yourself anxious to learn the language.

Although macros are available in the entire Microsoft Office Microsoft's primary desktop applications for Windows and Mac. Depending on the package, it includes some combination of Word, Excel, PowerPoint, Access and Outlook along with various Internet and other utilities.  Suite--including Word, Access, PowerPoint and Outlook--we're going to show you how they work in Excel, which is where they really show their muscle for CPAs and other finance professionals. Once you start using them, you'll likely find your work output increasing substantially.

Follow along and we'll create a macro simply by recording the keyboard strokes and mouse clicks needed to perform a typical accounting task--setting up a workpaper. As you proceed, Excel translates your recorded steps into VB. Once they're recorded you can command Excel to replay them. It usually takes about five minutes to set up workpapers manually; with a macro, it takes seconds.

As you can see in exhibit 1, below, we have a standard custom format for all our workpapers, which includes a line for the client name, workpaper name, period, purpose, initials and date.

To instruct Excel to begin recording, select Tools, Macros, Record New Macro (exhibit 2, page 47).

That will engage the Record Macro dialog box A movable window that is displayed on screen in response to the user selecting a menu option. It provides the current status and available options for a particular feature in the program.  (exhibit 3, page 47).

Under Macro name select something short and friendly. Note that macro names must be one word. We've selected SetupWorkpaper. Under the Shortcut key A keyboard key that invokes a function in the operating system or application when pressed. Shortcut keys, which may involve pressing two or three keys at the same time, are set up for common tasks such as launching a favorite program. See also Win Shortcuts.  pick a letter that, when pressed simultaneously with Ctrl, will execute the completed macro. We've selected the letter S. The shortcut key method is only one of the numerous ways to execute the macro; we'll show you more later.

Under Store macro in you have several location options. If the macro will be run in only one specific workbook work·book  
n.
1. A booklet containing problems and exercises that a student may work directly on the pages.

2. A manual containing operating instructions, as for an appliance or machine.

3.
, save it in that workbook. If you would like to run the macro in several workbooks, save it in your Personal Macro Workbook. It's important to remember where you save the macro text.

If you save it in the Personal Excel Workbook, a dialog box asking you to confirm your decision will open (exhibit 4, below). Click on Yes.

Now you're ready to begin the recording process. Click on OK in exhibit 3, which remains on your screen. Excel signals that it's ready to record your keystrokes by the presence of the small Stop dialog box (exhibit 5, at right).

Now perform all the steps to set up your custom workpaper, such as entering the text and formatting it. When you're done, click on the Stop button.

EXECUTING A MACRO

Once you have a macro in memory, let's see Let's See was a Canadian television series broadcast on CBC Television between September 6, 1952 to July 4, 1953. The segment, which had a running time of 15 minutes, was a puppet show with a character named Uncle Chichimus (voice of John Conway), which presented each  how to run it. Begin by opening a new workbook. Remember we mentioned there are several ways to launch your macro. You can use the shortcut key, Ctrl+S, which is the easiest; however, if you create many macros you may not be able to remember which key triggers which macro. The other methods--the Form button, the Toolbar A row or column of on-screen buttons used to activate functions in the application. Many toolbars are customizable, letting you add and delete buttons as required. Toolbars may be fixed in position or may float, which means they can be dragged to a more convenient location in the  button or the Macro box--provide you with the macro name.

* The Form button: Click on View, Toolbars and Forms (exhibit 6, below).

Doing that will launch the Forms Toolbar (exhibit 7, at right).

Click on the button icon (row 2, right side) and then click anywhere in your worksheet to create the button, as shown in exhibit 8, below.

When you click on the button, you will be prompted by the Assign Macro screen to identify which macro to run. Each macro that you create will be listed under Macro name.

* The Toolbar button: To create such a button, click on Tools, Customize and then on the Toolbars tab (exhibit 9, below).

Select Macros from the Commands field and click on and drag Custom Button to anywhere in the toolbar. Later, by right-clicking on the newly created toolbar button, you can change the smiley See emoticon.

smiley - emoticon
 face icon and then assign the macro (exhibit 10, below).

* The Macro dialog box: Select Tools and Macro (exhibit 11, below).

That will launch the Macro dialog box, which then will list all the available macros (exhibit 12, below).

To execute a macro, select it from the list and click on Run.

LOOK AT THE CODE

For those who would like to "look under the hood under the hood - [hot-rodder talk] 1. The underlying implementation of a product (hardware, software, or idea). Implies that the implementation is not intuitively obvious from the appearance, but the speaker is about to enable the listener to grok it. " and see the VB code that Excel wrote for the macro, click on Tools, Macros and Visual Basic Editor. Here you can view the code, and once you become familiar with the language, you can edit it, too. The box at right shows what a portion of the code looks like.

If you want to learn more about VB, check out Microsoft's Visual Basic for Applications home page at http://msdn.microsoft.com/vba/. There also are many books on the subject; one popular one is Mastering Visual Basic 6 by Evangelos Petroutsos (Sybex Inc., 1999).

If you don't want to spend the time writing VB code from scratch, there are many places on the Internet where you can find completed macros for many different applications that you can adapt for your own use. Just do a Google search Google is owned by Google, Inc. whose mission statement is to "organize the world's information and make it universally accessible and useful". The largest search engine on the web, Google receives several hundred million queries each day through its various services.  for Visual Basic macros.

Whether you become an expert in macro code or just use the recording method, you'll find macros can help you speed many of your repetitive operations and boost your productivity.

Key to Instructions

To help readers follow the instructions in this article, we use two different typefaces This is a list of typefaces. Serif
Here you can find a graphical version of this table.
  • Aldus
  • Antiqua
  • Aster
  • Baskerville
  • Bell (Monotype) Didone classification serif type deisgned by Richard Austin, 1788
  • Bembo
  • Benguiat
:

* Boldface See boldface font.  type is used to identify the names of icons, agendas and URLs.

* Sans serif Short horizontal lines added to the tops and bottoms of traditional typefaces, such as Times Roman. Contrast with sans-serif.

 type shows commands and instructions users should type into the computer and the names of files.

Macro Security

Depending on which version of Excel you have and whether you've downloaded the latest Microsoft service pack, you may get an alert each time you open a file that contains a macro. Microsoft inserted the alert because macros can be programmed to act like viruses-instructed to delete files See file wipe and delete.  and otherwise wreak wreak  
tr.v. wreaked, wreak·ing, wreaks
1. To inflict (vengeance or punishment) upon a person.

2. To express or gratify (anger, malevolence, or resentment); vent.

3.
 havoc on your system. It's a good security practice to never enable macros unless you are absolutely sure they come from a trusted source.
Sub SetupWorkpager ()
'
' SetupWorkpaper Maco
' Macro recorded 5/20/2004 by Jeff Lenning
'
' Keyboard Shortcut: Ctrl+s
'
Range ("D1").Select
ActiveCell.FormulaR1C1 = 'Click Consulting"
Range("D2").Select
ActiveCell.FormulaR1C1 = "Accounts Receivable Detail:
Range("D3").Select
ActiveCell.FormulaR1C1 = "FYE: 6/30/2004"
Range("A5").Select
ActiveCell.FormulaR1C1 = "Purpose"
Range("B5").Select
ActiveCell.FormulaR1C1 = "The purpose of this worksheet is to "
Range("A6").Select
Range("B5").Select
ActiveCell.FormulaR1C1 =
"The purpose of this worksheet is to provide the detail"
Range("B6").Select
Range("B5").Select
ActiveCell.FormulaR1C1 =
"The purpose of this worksheet is to provide the detail for the "
Range("B6").Select
ActiveCell.FormulaR1C1 = "6/30/2004 Accounts Receivable balance."
Range("A5").Select
Selection.Font.Bold. = True
Range("D1:D3").Select
With Selection
.HorizoantalAlignment - x1Center
.VerticalAlingment = x1Bottom
.WrapText = False
.Orientation = 0
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = x1Cotnext
.MergeCells = False


JEFF Jeff

boob who usually bungles Mutt’s schemes. [Comics: Berger, 48]

See : Dimwittedness
 LENNING, CPA (Computer Press Association, Landing, NJ) An earlier membership organization founded in 1983 that promoted excellence in computer journalism. Its annual awards honored outstanding examples in print, broadcast and electronic media. The CPA disbanded in 2000. , is the founder of Click Consulting, Seal Beach Seal Beach, city (1990 pop. 25,098), Orange co., S Calif., on the Pacific coast; inc. 1915. It is a beach city with an active art colony. Transportation equipment and concrete are among the city's manufactures. U.S. naval stations are nearby. , California. His company provides IT solutions, support and development. His e-mail address See Internet address.

e-mail address - electronic mail address
 is jeff@clickconsulting.com and his Web site is www.clickconsulting.com
COPYRIGHT 2005 American Institute of CPA's
No portion of this article can be reproduced without the express written permission from the copyright holder.
Copyright 2005, Gale Group. All rights reserved. Gale Group is a Thomson Corporation Company.

 Reader Opinion

Title:

Comment:



 

Article Details
Printer friendly Cite/link Email Feedback
Author:Lenning, Jeff
Publication:Journal of Accountancy
Date:Jan 1, 2005
Words:1276
Previous Article:Tax season defanged: year-round attention to your tax preparation practice makes busy season easier.
Next Article:Class-based pensions: a cost-saving alternative for companies of all sizes.
Topics:



Related Articles
A spreadsheet update: the battle of the spreadsheets intensifies.
The power of spreadsheets. (software programs)
Drilling for information.(computerized financial reports)
Yes, you can program in VBA.(Visual Basic for Applications)
Make your mark in spreadsheets.(using Excel software tools in auditing)
Automate shortcuts.(custom menus to make applications used in accounting more efficient.)
Authoring for live desktop training.(an evaluation of InfoSource Inc.'s Masterpiece Maker ILT Authoring System software program)
Authoring for live desktop training.(Software)(Product/Service Evaluation)
Click ... and the database loads into Excel: an easy way to import data into a spreadsheet.
Navigate speedily in excel data: click on a button to get to target information.

Terms of use | Copyright © 2009 Farlex, Inc. | Feedback | For webmasters | Submit articles