Anda di halaman 1dari 2

Recording a macro to put a colored border around a range Heres a neat example.

Suppose there are many times youd like to place a blue border around a range. Wouldnt it be nice to simply select the range (or ranges), click on a button, and have the blue border(s) appear? he procedure, !hich only ever has to be done once on a given "#, is as $ollo!s% &. Select any range. '. urn on the macro recorder (!ith the ools()ecord *acro()ecord +e! *acro menu item).

,. -ive the macro a suggestive name, such as .lue.order, in the *acro +ame box, and then click on the /ptions button to obtain a dialog box. 0. 1nder the Store 2n section, click on "ersonal *acro Workbook and then click on /3. his stores your macro in a $ile called "ersonal.xls, !hich is stored in your 45Start directory so that it al!ays opens !hen you open 6xcel. (2t is usually stored as a 7hidden8 $ile, so that you dont actually see it. .ut its there, and all o$ the macros in it are available to you at any time.) +ote% 9ou might not be allo!ed to do this in your school:s lab, but it should !ork $ine on your o!n "#. ;. he recorder is no! running, so anything you do is being recorded<so be care$ul. -o through the procedure o$ putting a blue border around the range you selected. ( o do this, use the =ormat(#ells menu item, click on the .orders tab, and make the obvious selections to get a blue outline border.)

>. /nce youve got the blue border, click on the black s?uare 7stop8 button thats $loating some!here on the screen. his turns o$$ the recorder. @. o check !hether the macro is !orking correctly, select any range and 7run8 the macro. o run it, use the ools(*acro menu item, click on the macro name you Aust recorded, and click on the )un button. 9ou should get a blue border around the selection. (Bctually, try running it !ith more than one range selected. 9ou should get a blue border around each selected range. his makes the macro even more use$ulC)

Customizing toolbars 6xcel provides several toolbars. !o o$ these, the Standard and =ormatting toolbars, appear by de$ault !hen you open 6xcel. 6ach o$ the buttons on these toolbars has a macro assigned to it, so that !hen you click on the button, some use$ul task is carried out. 9ou might not kno!, ho!ever, that there are several other toolbars you can make visible at any time. 2n addition, there are a number o$ preprogrammed buttons that you can add to any o$ the toolbars, and you can delete any o$ the 7standard8 buttons you never use. 9ou can even $orm your o!n toolbars and customiDed buttons (that run your o!n macros), and its all ?uite easy. his section !ill explain ho!. o see a list o$ toolbars and sho! or hide any o$ them% "ut the cursor over any toolbar and right click. 9oull see a list o$ toolbars. #lick on any to place checks next to those you !ant to sho! or remove checks next to those you !ant to hide.

o add preprogrammed buttons to any o$ the builtEin toolbars (or delete any buttons)% "ut the cursor over any toolbar and right click. #hoose the #ustomiDe option at the bottom and then click on the #ommands tab in the resulting dialog box. (9ou can also get to this #ustomiDe dialog box !ith the ools(#ustomiDe menu item.) 9oull see a list o$ categories and buttons. #lick on any category and then click on any button. 9oull see a short description o$ !hat this button does at the bottom o$ the dialog box. 2$ youd like to have this button on a toolbar, simply drag it to the toolbar. Similarly, i$ there is any button on a toolbar that you never use, simply drag it o$$ the toolbar to delete it. o add your o!n button (!ith your o!n macro) to a toolbar% 5ets say youve recorded the macro .lue.order (as above) and you no! !ant to attach it to a button that youll place on a toolbar. "ut the cursor over any toolbar, right click, choose the #ustomiDe option, and click on the #ommands tab. Scroll do!n the list o$ categories until you get to the *acros category, and click on it. 9oull see a generic Fhappy $aceF button that doesn:t have any preprogrammed macro attached to it. his button $or your useC #lick on it and drag it up to a toolbar. +o! right click on your ne! button (!ith the #ustomiDe dialog box still open) to see a menu. #lick on Bssign *acro, and then select .lue.order $rom the list o$ macros sho!n. his assigns your macro to the button. Bt this point you probably !ant a more suggestive picture (icon) on your ne! button. 9ou have t!o options. he $irst is to right click on the button (!ith the #ustomiDe dialog box still open) and select the 6dit .utton 2mage menu item. his takes you to a 7paint8 program !here you can paint the image you !ant (such as a blue rectangular border). Blternatively, you can 7borro!8 an image and then modi$y it. o do this, right click on a button !hose image you !ant to borro! and select the #opy .utton 2mage menu item. hen right click on your ne! button and select the "aste .utton 2mage menu item. =inally, right click again on your ne! button, select the 6dit .utton 2mage menu item, and modi$y the image as you like. (+ote% 2$ youd like to mimic the image o$ a button that sho!s in the #ustomiDe dialog box but isnt yet on a toolbar, youll need to drag this to a toolbar $irst. 9ou can al!ays drag it o$$ a$ter youve copied its image.) =inally, right click on the button and type .lue /utline .order next to the +ame% menu item. his creates a Ftool tipF $or your button. =rom then on, !hen you put your cursor over the button, you:ll see this tool tip. o create a ne! toolbar (that !ill probably contain your customiDed buttons)% "ut the cursor over any toolbar, right click, choose #ustomiDe, click on the oolbars tab, and click on the +e! button. his allo!s you to create a ne! toolbar !ith a name you can choose. =rom that point your ne! toolbar is Aust like any o$ the ones that came !ith 6xcel. 9ou can sho! it or hide it, and you can add buttons to it. 2n $act, it starts out empty, so you !ill have to add buttons to it to make it use$ul. 2$ you mess up, or i$ you don:t need your ne! toolbar any longer, Aust go to #ustomiDe and the oolbars tab, select your toolbar, and click on Gelete.

Anda mungkin juga menyukai