Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro To Create Other Macros And Buttons

I create Excel spreadsheets to track all kinds of sports statistics. I would
like to programmatically place two buttons above each column that contains
data to sort based on that column. This gives the users a quick way to sort.
So, in A1 I'd have a (+) button and a (-) button. The actual data would
start in A2. The buttons would run macros to sort ascending (+) or sort
descending (-). This is a tedious process manually. I need to write macros
then I need to place buttons then assign macros. I would like to define the
macros along with the buttons inside another macro.

Is this possible?

This is a sample of the macros that I currently use:

Sub d_kick_td_asc()
Call rank("AF6", "A")
End Sub

Sub d_kick_td_desc()
Call rank("AF6", "D")
End Sub

Function rank(col, upd)
If (col = "") Then col = "A6"
If (upd = "A" Or upd = "a") Then
upd = xlAscending
Else
upd = xlDescending
End If
*Range("all").Select
Selection.Sort Key1:=Range(col), Order1:=upd, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
ActiveWindow.LargeScroll ToRight:=-1
ActiveWindow.LargeScroll Down:=-6
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 6
Range(col).Select
End Function

*Note: "all" has been previously defined.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to create Sort buttons Mr X Z Excel Discussion (Misc queries) 9 July 3rd 11 09:16 AM
Macros AND Buttons [email protected] Excel Worksheet Functions 3 August 9th 06 09:03 AM
Sharing macros and buttons that accompany the macro JDub Excel Discussion (Misc queries) 5 November 17th 05 10:16 PM
How do I create a scroll list of macro buttons? RobertM Excel Discussion (Misc queries) 1 October 31st 05 09:50 PM
buttons & macros Jock W Excel Worksheet Functions 4 April 30th 05 07:35 AM


All times are GMT +1. The time now is 06:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"