G
Guest
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(xlUp).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
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(xlUp).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