Customizing a toolbar icon

  • Thread starter Thread starter Hans Knudsen
  • Start date Start date
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
 
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.
 
Shane Devenshire

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

Hans
 
Back
Top