M
mmadden2
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 x>9 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
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 x>9 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