adding macros to buttons (jofa 1-07)

Upload: peter

Post on 06-Jul-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/18/2019 Adding Macros to Buttons (JofA 1-07)

    1/3

    TE HNOLOGY WORKSHOP

    Navigate Speedily inExcel DataClick on a button to get to target information.

    by James T. Severson

    I

    f you re like most financial professionals, some of your large spread-sheets contain many worksheets with a wide assortment of data.Locating information or identifying just the right worksheet or cellto input new data is like searching for the proverbial needle in a

    haystack. If this describes a problem you often face, then read on tofind out how to create a spreadsheet that, with a single mouse click,can take you instantly right to the target cell.

    » ey to Instructions

    To help re ders follow the instructions n

    this article we use two different typefacesBoldface type is used to identify the nameof icons gend s and URLs.San s serif type shows the n mes of files ndthe names of comm nds and instructionsthat users should type into the computer

    The solution is based on two Fxcel toolsForms Toolbar But tons and Macro . Wwill show you how to install and formatthose functions on a conten ts page that

    contains button s designed to speed you tyour data destinations.

    Begin by creating a blank worksheetand label it Contents Page, The n, in vari-ous cells, list all the data targets that wibe stored in subsequent worksheets. If yowish, add additional information that cabe printed on or next to the bu t tons toguide you on when to use the b uttons-

    Fxhibit 1 beiow, is an example of acompleted contents page that includeboth the data-locating but ton s and theuser instructions.

    Next add the actual buttons and thethe macro commands that wil l wing yo

    3

    5

    6

    7

    IB 9

    •> n

    1) Go to the Input W IIBS data [and input the revenues from the CIS report ar d uf*>illed

    calculation on quarters.2) Go to the calculation* [and input the sales from the CIS report and the unbilled

    calculation on quarters.

    3) Go to the Input cuatomera [and input red cedar and pra irie creeK plant cus tom ers.

    4) Go to the Input fti«i land input fuel expense from the general ledger.

    6) Go to the Margin Report [and review report for reason ablenes s.

    6) Go to tt>e ' P * m mgtte [and input the unbilled steam s ales Infomnation from ttie CIS pro-ration repo rt

    7J Go to the unbilled JE [fpf monthly steam unbilled JE .

  • 8/18/2019 Adding Macros to Buttons (JofA 1-07)

    2/3

    TE HNOLOGY WORKSHOP

    instantly to your targets. Begin by right-clickingin any free space in the toolbar area of the w ork-sheet to engage a drop-d own menu . Then cfickon Forms (exhibit 2, at right).

    That v«il open a Forms toolbar; it contains,among other things, a Button icon. To locate theicon, drag your cursor overthe toolbar until the Buttonlabel appears (see screensh otat right).

    Now left-click on theButton icon and move yourcursor to the cell on the co n-tents page where you want toinstall the first bu tto n seescreenshot, below).

    Exhibit 2

    l he revenues from tfie t

    he sales from the CIS rcj

    ed cedar and prairie cr^

    uel expense from the

    J Stnndord

    I FormaitingBorfters

    Chart

    Control Toolbox

    Dmwiftg

    Exit Design Mode

    Bdemal Dst

    Forms

    Formula AiMliting

    List

    Ptchire

    Ptvotrable

    Protection

    on the Stop Recording but -ton until you reach yourdata target (see the screen-shot below).

    f

    io n o n q u a r te r s

    You can change thesize of a button anytime by grabbing anddragging any of the tiny circfes afong theedges. Left-clicking on the bu tto n aflowsyou to edft the text. For this exercise,we lf label the first but to n input revenue.

    Now create a mac ro that will take you

    directly lo the w orkshee t targ et—in this case input revenue. En-gage the Assign Macro menuby right-clicking on the button(see screenshot, at right),

    ff you k no w Visual Basic, themacro software, you can writethe script yourself, b ut it s a loteasier to let Excel do it for yo u.All you ha ve to do is go th roug hthe physical cursor and key-

    f^rouping

    AJMQQ MBCTC I

    £ tn Control

    board steps needed to performthe command and Excel will record and translate them into themacro language.

    Begin by clicking on Tools Macro and then, from

    the drop-down menu, select Macro Record New

    Macro (see screenshot below).

    N ow go through all thekeyboard and mous e clicksneeded to maneuver to thedata target. Once thereclick on Stop RecordingNow, to assign that newMacro to your first but ton ,

    re turn to the conte nts page,^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ right-click on the b utton , se

    lect the Assign Macro op-tion, click on the macro nam e you created an d on OK (see ex-hibit 3, below).

    Follow the same steps for each comm and you want on thecontents page.

    Finally, set up a button in o ne of the wor kshee ts and createa macro that returns you to the con tents page (see scree nshobelow). This return button and m acro comm and ne eds to be sup only once since you can then copy and paste it to all theother worksheets.

    Return to ontents Pâ e |

    Now, no matter how complex a spreadsheet fs, by adding aset of strategically located buttons and com plem entary macroyou can instantly be taken to any location in the file. No morewasted time clicldng from one worlcsheet to another searchingfor a piece of data or a specific p lace to enter new data. • •

    James TSeverson CPA is utili ty accounting manager at Alliant Energy Cedar

    Rapids Iowa. is e-mail address is [email protected].

    Exhibit 3

    Templates nd Add-lns...

    r-Mt Options...

    W hen you re prompted to assign a name and de-script ion to th e Macro use the button label (Input-Sales-Data, for exam ple). Note that macro na mesmust be one word, so be sure to add dashe s between

    the words. Then click on OK, which opens a StopRecording toolbar option window, but o not click

    AssKiri M.iini X|

    Macro name:

    Input. Sales.Oata

    cgaPERSONALXLSICOpyD

    customers

    eacdsm

    emargrate

    PERSQNALXLSI EndReview

    fourg

    fourgqrtfu d

    Input_Sales_DatB

    OK

    Cancel

    £dit

    Record..

  • 8/18/2019 Adding Macros to Buttons (JofA 1-07)

    3/3