ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   add a button on a spreadsheet that runs a macro (https://www.excelbanter.com/excel-programming/374089-add-button-spreadsheet-runs-macro.html)

Easygoin123

add a button on a spreadsheet that runs a macro
 
I have set up a payroll spread sheet in the PC's we have in our stores in 9
states. Payroll is requesting the sheet be sorted alphabetically before
being faxed or emailed to them. I set up a control S to sort but wondered if
an activeX button in the spread sheet would work [left click with a mouse]
since the majority of the managers in the stores are not into computers. If
it would work How would I set it up and lock it so they could not mess it up?

Ron de Bruin

add a button on a spreadsheet that runs a macro
 
Sure

Record a macro when you do it manual and you can enter the macro name in the button click event

You can use something like this with headers in row 1 and your data start in A2
This sort on column A

Range("A1").CurrentRegion.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Easygoin123" wrote in message ...
I have set up a payroll spread sheet in the PC's we have in our stores in 9
states. Payroll is requesting the sheet be sorted alphabetically before
being faxed or emailed to them. I set up a control S to sort but wondered if
an activeX button in the spread sheet would work [left click with a mouse]
since the majority of the managers in the stores are not into computers. If
it would work How would I set it up and lock it so they could not mess it up?





All times are GMT +1. The time now is 05:42 PM.

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