ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Customizing a toolbar icon (https://www.excelbanter.com/excel-programming/418495-customizing-toolbar-icon.html)

Hans Knudsen

Customizing a toolbar icon
 
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


ShaneDevenshire

Customizing a toolbar icon
 
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.
--
Thanks,
Shane Devenshire


"Hans Knudsen" wrote:

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


Hans Knudsen

Customizing a toolbar icon
 
Shane Devenshire

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

Hans


"ShaneDevenshire" wrote in
message ...
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.
--
Thanks,
Shane Devenshire


"Hans Knudsen" wrote:

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




All times are GMT +1. The time now is 09:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com