Customizing a toolbar icon

H

Hans Knudsen

Is it possible to have the Center icon perform a double job like for example
the Sort Ascending icon (Shift+Sort Ascending and sort is performed in
descending order) so that if I pres Shift+Center the following code should
run:

Sub SelectionCenterAcross()
On Error Resume Next
Selection.HorizontalAlignment = xlCenterAcrossSelection
End Sub

Regards
Hans Knudsen
 
S

ShaneDevenshire

Hi Hans,

There already is a second function assigned to the Center button - it is
Merge and Center. Just hold down the shift key for this functionality.

If you want a button for Center Across Selection you can add a new blank
button to the any toolbar and assign you macro to it. To add a button -
choose View, Toolbars, Customize, Commands tab, Macros Categroy, and drag
Custom Button to the toolbar. Then right click the new button and choose
Assign Macro and pick your code.
 
H

Hans Knudsen

Shane Devenshire

Thank you.
I wasn't aware that 'Center' already has this double function.

Hans
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top