Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Sorting an Addin Worksheet

Anyone -

Can you tell me the code an Addin would use to sort cells on a worksheet in
the Addin?

I've tried this, but it does not always work:

Workbooks("MyAddInName.xla").Activate
Sheets("Sheet1").Activate
Columns("A:C").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("B1") _
, Order2:=xlAscending, Key3:=Range("C1"), Order3:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom


Thank you for any assistance.

MSweetG222

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Sorting an Addin Worksheet

Addins are hidden. And it's not possible to select hidden sheets (or ranges on
sheets that aren't selected).

But you can do it without the .activate and .selects

with Workbooks("MyAddInName.xla").worksheets("Sheet1"). range("A:C")
.cells.Sort Key1:=.columns(1), Order1:=xlAscending, _
Key2:=.columns(2), Order2:=xlAscending, _
Key3:=.columns(3), Order3:=xlAscending, _
Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
end with

MSweetG222 wrote:

Anyone -

Can you tell me the code an Addin would use to sort cells on a worksheet in
the Addin?

I've tried this, but it does not always work:

Workbooks("MyAddInName.xla").Activate
Sheets("Sheet1").Activate
Columns("A:C").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("B1") _
, Order2:=xlAscending, Key3:=Range("C1"), Order3:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Thank you for any assistance.

MSweetG222


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Sorting an Addin Worksheet

Thank you so much.

--
Thx
MSweetG222



"Dave Peterson" wrote:

Addins are hidden. And it's not possible to select hidden sheets (or ranges on
sheets that aren't selected).

But you can do it without the .activate and .selects

with Workbooks("MyAddInName.xla").worksheets("Sheet1"). range("A:C")
.cells.Sort Key1:=.columns(1), Order1:=xlAscending, _
Key2:=.columns(2), Order2:=xlAscending, _
Key3:=.columns(3), Order3:=xlAscending, _
Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
end with

MSweetG222 wrote:

Anyone -

Can you tell me the code an Addin would use to sort cells on a worksheet in
the Addin?

I've tried this, but it does not always work:

Workbooks("MyAddInName.xla").Activate
Sheets("Sheet1").Activate
Columns("A:C").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("B1") _
, Order2:=xlAscending, Key3:=Range("C1"), Order3:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Thank you for any assistance.

MSweetG222


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Sorting an Addin Worksheet

Dave - Sorry to bother you again...
I am getting a "Sort method of Range class failed" error.

--
Thx
MSweetG222



"Dave Peterson" wrote:

Addins are hidden. And it's not possible to select hidden sheets (or ranges on
sheets that aren't selected).

But you can do it without the .activate and .selects

with Workbooks("MyAddInName.xla").worksheets("Sheet1"). range("A:C")
.cells.Sort Key1:=.columns(1), Order1:=xlAscending, _
Key2:=.columns(2), Order2:=xlAscending, _
Key3:=.columns(3), Order3:=xlAscending, _
Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
end with

MSweetG222 wrote:

Anyone -

Can you tell me the code an Addin would use to sort cells on a worksheet in
the Addin?

I've tried this, but it does not always work:

Workbooks("MyAddInName.xla").Activate
Sheets("Sheet1").Activate
Columns("A:C").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("B1") _
, Order2:=xlAscending, Key3:=Range("C1"), Order3:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Thank you for any assistance.

MSweetG222


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Sorting an Addin Worksheet

Did you copy and paste the code or did you type it from scratch?

If you typed it, double check those dots--they're important.

Another thing to check--is the worksheet protected?

If you can't find it, post your code.

MSweetG222 wrote:

Dave - Sorry to bother you again...
I am getting a "Sort method of Range class failed" error.

--
Thx
MSweetG222

"Dave Peterson" wrote:

Addins are hidden. And it's not possible to select hidden sheets (or ranges on
sheets that aren't selected).

But you can do it without the .activate and .selects

with Workbooks("MyAddInName.xla").worksheets("Sheet1"). range("A:C")
.cells.Sort Key1:=.columns(1), Order1:=xlAscending, _
Key2:=.columns(2), Order2:=xlAscending, _
Key3:=.columns(3), Order3:=xlAscending, _
Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
end with

MSweetG222 wrote:

Anyone -

Can you tell me the code an Addin would use to sort cells on a worksheet in
the Addin?

I've tried this, but it does not always work:

Workbooks("MyAddInName.xla").Activate
Sheets("Sheet1").Activate
Columns("A:C").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("B1") _
, Order2:=xlAscending, Key3:=Range("C1"), Order3:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Thank you for any assistance.

MSweetG222


--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Sorting an Addin Worksheet

Thanks for pointing out the dots. Left out the dots on the column keys.
Works perfectly now. Thanks for saving my hair (I was pulling it out)!
--
Thx
MSweetG222



"Dave Peterson" wrote:

Did you copy and paste the code or did you type it from scratch?

If you typed it, double check those dots--they're important.

Another thing to check--is the worksheet protected?

If you can't find it, post your code.

MSweetG222 wrote:

Dave - Sorry to bother you again...
I am getting a "Sort method of Range class failed" error.

--
Thx
MSweetG222

"Dave Peterson" wrote:

Addins are hidden. And it's not possible to select hidden sheets (or ranges on
sheets that aren't selected).

But you can do it without the .activate and .selects

with Workbooks("MyAddInName.xla").worksheets("Sheet1"). range("A:C")
.cells.Sort Key1:=.columns(1), Order1:=xlAscending, _
Key2:=.columns(2), Order2:=xlAscending, _
Key3:=.columns(3), Order3:=xlAscending, _
Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
end with

MSweetG222 wrote:

Anyone -

Can you tell me the code an Addin would use to sort cells on a worksheet in
the Addin?

I've tried this, but it does not always work:

Workbooks("MyAddInName.xla").Activate
Sheets("Sheet1").Activate
Columns("A:C").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("B1") _
, Order2:=xlAscending, Key3:=Range("C1"), Order3:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Thank you for any assistance.

MSweetG222

--

Dave Peterson


--

Dave Peterson

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
How do I edit a worksheet that has been defined as an addin Guy Normandeau Excel Discussion (Misc queries) 3 June 30th 06 07:00 PM
Worksheet visible in an addin ? DS NTE Excel Programming 4 August 26th 05 08:06 PM
Access to Worksheet in AddIn.xla Robin Clay[_3_] Excel Programming 3 December 10th 03 01:05 PM
Using UDF in COM Addin as formula in worksheet Ralf Zimmermann Excel Programming 1 September 3rd 03 02:09 PM
raw speed for excel worksheet functions? - xll -or com addin? John Doe[_3_] Excel Programming 1 August 18th 03 11:26 PM


All times are GMT +1. The time now is 05:56 PM.

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"