Toggle Button - Sort Information in columns

Toshura

New Member
Joined
Sep 27, 2018
Messages
4
Disclaimer: I have a basic understanding of scripting.

I've created a toggle button and I want it to toggle ascending & descending in a range of cells. I've been trying to do just a column cell range with this script, but I don't like how it collapses up to the top.

PHP:
Private Sub ToggleButton6_Click()


If ActiveSheet.AutoFilterMode = True Then
'autofilter is on...
ActiveSheet.AutoFilterMode = False
Else
'autofilter is not on...
ActiveSheet.Range("$D$3:$D$500").AutoFilter Field:=1, Criteria1:="D"
End If
End Sub

I've also been playing (and really like this one!) with this script to sort a range based on what cell is selected, but can't figure out how to get it to attach to ToggleButton6.
PHP:
Sub Sort_Me_Please()
Selection.Resize(67, 1).Select
Selection.Sort Key1:=ActiveCell, Order1:=xlAscending, Header:=xlNo
End Sub

Any help/educating is appreciated!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Right Click on the button and pick assign macro then pick the macro you want associated with the macro.
 
Upvote 0
Right Click on the button and pick assign macro then pick the macro you want associated with the macro.

Thank you for responding! But, I do not have this option when right-clicking:confused:.

Right Click Menu Options =
-Cut
-Copy
-Paste
-Properties
-View Code
-ToggleButton Object
-Grouping
-Order
-Format Control...

I'm working in the VBA screen and the code for the other buttons in this sheet references the toggle button. i.e.
Code:
Private Sub ToggleButton4_Click()
This does not work for the Sub Sort_Me_Please(). I can get it to work by pressing play in the VBA screen.
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,998
Members
448,539
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top