LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default sort using forms button - cycle thru 9 columns

hi all,

i've come across some nifty sorting code and it works well for me (excel
2003). so far i am able to create a forms button and assign it to this macro.
here's how it currently works...

i have data in 9 columns. row 1 is the headers. when you click the button,
data from one of the columns is sorted. perfect. what i would really like to
do is click that single button over and over and have the macro cycle from
column to column, sorting as it goes.

example... click (sort by A1), click (sort by B1), click (sort by C1) and so
on. after the ninth click i want it to go back to the first column again.

it sounds so simple: x=x+1, if x9 then x=1: sort by column x

i just don't know vba syntax very well. so without further adu here is the
code i would like to add a counter to...

'range to sort
Worksheets("Sheet1").Range("A2:I100").Sort _
'column to sort by
Worksheets("Sheet1").Range("A1")

thank you very much for any help,

marc
 
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
Button to sort a range, and sorting 12 columns [email protected] Excel Worksheet Functions 2 October 19th 06 04:14 AM
How do I keep result from 1 iteration cycle to use in next cycle? sgl8akm Excel Discussion (Misc queries) 0 July 27th 06 08:28 PM
hiding forms button bigtonyicu Excel Discussion (Misc queries) 1 August 11th 05 11:00 PM
Cycle thru & format all columns Arawn Excel Programming 4 November 19th 03 02:01 AM
Option Button and forms paradise Excel Programming 1 October 27th 03 12:32 PM


All times are GMT +1. The time now is 08:58 PM.

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

About Us

"It's about Microsoft Excel"