LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default Sorting From Macro in another workbook

I have code in a workbook1 which opens workbook2, does some trivial items,
then selects the range A:K in workbook 2. I am then trying to sort the range
in workbook2 from the code in workbook1, but am getting the following error:

"Run time error '1004': Application defined or object defined error."

Following is the select code. Can someone please tell me what is causing
the error and how to correct? Thanks.

Workbooks.Open Filename:="P:\PRT\IndustryReview\Client Summary
Performance.xls"
Windows("Client Summary Performance.xls").Activate
ActiveWorkbook.ActiveSheet.Range("A65536").End(xlU p).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues
Selection.PasteSpecial Paste:=xlPasteFormats
Columns("A:K").Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range("B2") _
, Order2:=xlDescending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
 
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
Sorting Worksheets in a workbook Doehead Excel Worksheet Functions 5 May 21st 10 12:20 AM
saving macro from workbook to Personal Macro Workbook KrispyData Excel Discussion (Misc queries) 1 March 25th 10 05:52 PM
linking within a workbook and sorting bmac Excel Discussion (Misc queries) 2 October 8th 09 04:23 PM
Sorting a Workbook w/ Links em Excel Worksheet Functions 0 March 11th 09 01:20 PM
Sorting in Shared Workbook Colleen Tinney Excel Worksheet Functions 0 July 13th 06 03:31 PM


All times are GMT +1. The time now is 07:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"