Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Sort Ascending or Descending using Option Button

I have a user-form with 3 option buuttons, depending on which option is
clicked the event runs and the data is sorted by the relevant column. How do
I add in an extra couple of options that will toggle between sorting the
data select option either ascending or descending.

thanks

Gaz


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Sort Ascending or Descending using Option Button

I assume you are up to date on adding option buttons to the form and are
looking for code modifications to use the choice. with two option buttons
OptionButton_Ascending
Optionbutton_Descending


Dim ord as Long

ord = 0 ' no choice made
if optionbutton_Descending then
ord = xlDescending '2
elseif optionbutton_Ascending then
ord = xlAscending '1
end if

if ord = 0
' use current setting
selection.Sort Key1:=whatever
else
' use selected order
selection.Sort Key1:=whatever, order1:=ord
end if



--
regards,
Tom Ogilvy

"Gazza" <mallin"nospam" wrote:

I have a user-form with 3 option buuttons, depending on which option is
clicked the event runs and the data is sorted by the relevant column. How do
I add in an extra couple of options that will toggle between sorting the
data select option either ascending or descending.

thanks

Gaz



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Sort Ascending or Descending using Option Button

You may want to consider using a single checkbox with a "Sort Ascending" label.

Then you could just look at that one checkbox's value.

Gazza wrote:

I have a user-form with 3 option buuttons, depending on which option is
clicked the event runs and the data is sorted by the relevant column. How do
I add in an extra couple of options that will toggle between sorting the
data select option either ascending or descending.

thanks

Gaz


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Sort Ascending or Descending using Option Button

My original thought as well, but the sort dialog uses two option buttons -
so for interface consistency.

--
Regards,
Tom Ogilvy

"Dave Peterson" wrote in message
...
You may want to consider using a single checkbox with a "Sort Ascending"
label.

Then you could just look at that one checkbox's value.

Gazza wrote:

I have a user-form with 3 option buuttons, depending on which option is
clicked the event runs and the data is sorted by the relevant column. How
do
I add in an extra couple of options that will toggle between sorting the
data select option either ascending or descending.

thanks

Gaz


--

Dave Peterson



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Sort Ascending or Descending using Option Button

Not sure how to action this...

I used the click event on each of the original options to run a macro to
sort the data table. I have now grouped the original 3 options into a single
frame - how would I proceed to get the data sorted firstly based on the sort
option click and then by the direction of sort from the other 2 options
located on a second frame and would all this code need to be written on a
general module?

Thanks

Gaz

"Tom Ogilvy" wrote in message
...
I assume you are up to date on adding option buttons to the form and are
looking for code modifications to use the choice. with two option
buttons
OptionButton_Ascending
Optionbutton_Descending


Dim ord as Long

ord = 0 ' no choice made
if optionbutton_Descending then
ord = xlDescending '2
elseif optionbutton_Ascending then
ord = xlAscending '1
end if

if ord = 0
' use current setting
selection.Sort Key1:=whatever
else
' use selected order
selection.Sort Key1:=whatever, order1:=ord
end if



--
regards,
Tom Ogilvy

"Gazza" <mallin"nospam" wrote:

I have a user-form with 3 option buuttons, depending on which option is
clicked the event runs and the data is sorted by the relevant column. How
do
I add in an extra couple of options that will toggle between sorting the
data select option either ascending or descending.

thanks

Gaz





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
Ascending Sort formula, change to neg #: descending sort.. nastech Excel Discussion (Misc queries) 6 July 2nd 07 11:00 PM
Need to scroll up to access the ascending/descending option in fil MichelleBest Excel Worksheet Functions 7 June 22nd 06 08:21 PM
sort function - from ascending to descending jimmyp[_2_] Excel Programming 5 March 14th 06 06:11 PM
Sort other than by alphabetical ascending/ descending Melissa Excel Discussion (Misc queries) 6 September 2nd 05 07:25 AM
how can I hide sort ascending and sort descending options in the . vida Excel Discussion (Misc queries) 0 December 11th 04 12:31 AM


All times are GMT +1. The time now is 02:13 AM.

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"