Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am wanting to sort data in a worksheet from a command button on a different
worksheet. I want the focus to stay (or at least return) to the worksheet containing the command button. Is this even possible? If so, could someone supply a sample of code? Both worksheets are in the same workbook. Using excel 2003 . |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes. The trick is to not select the other sheet.
Option Explicit Private Sub CommandButton1_Click() Dim wks As Worksheet Dim myRng As Range Set wks = Me.Parent.Worksheets("Sheet2") 'some other sheet With wks Set myRng = .Range("A1:x99") 'some range End With With myRng .Cells.Sort _ key1:=.Columns(1), order1:=xlAscending, _ key2:=.Columns(3), order1:=xlAscending, _ header:=xlYes End With End Sub Phyllis wrote: I am wanting to sort data in a worksheet from a command button on a different worksheet. I want the focus to stay (or at least return) to the worksheet containing the command button. Is this even possible? If so, could someone supply a sample of code? Both worksheets are in the same workbook. Using excel 2003 . -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Check your other post.
Phyllis wrote: I am wanting to sort data in a worksheet from a command button on a different worksheet. I want the focus to stay (or at least return) to the worksheet containing the command button. Is this even possible? If so, could someone supply a sample of code? Both worksheets are in the same workbook. Using excel 2003 . -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Oops. I must have been seeing double!
Dave Peterson wrote: Check your other post. Phyllis wrote: I am wanting to sort data in a worksheet from a command button on a different worksheet. I want the focus to stay (or at least return) to the worksheet containing the command button. Is this even possible? If so, could someone supply a sample of code? Both worksheets are in the same workbook. Using excel 2003 . -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy/pasting data into a worksheet and then sorting worksheet | Excel Programming | |||
Sorting Master Worksheet to Regional Worksheet | Excel Worksheet Functions | |||
Worksheet sorting | Excel Discussion (Misc queries) | |||
Sorting a range on another worksheet without selecting the worksheet | Excel Programming | |||
worksheet sorting | Excel Worksheet Functions |