Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear all,
I am puzzled in the following situtations. There are 2 worksheets in the workbook, one for user menu and the other is the data. I would like to do some sorting in the data. As a result, I write down the following in the "UserMenu" worksheet. Sub Test2() Sheets("Data").Select ActiveSheet.Range(Cells(Firstrow, 1), Cells(Lastrow, 19)).Select Selection.Sort key1:=Range("R10") End Sub However, the coding got the error message "Run-time error 1004 - Application-defined or Object-defined error" However, if I paste the code into the "Data" sheet as follows : Sub Test2() ActiveSheet.Range(Cells(Firstrow, 1), Cells(Lastrow, 19)).Select Selection.Sort key1:=Range("R10") End Sub The code can be executed without any problem. What is the reason for the problem and your help will be much appreciated. BL |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run-time error '50290': Application-defined or object-defined erro | Excel Discussion (Misc queries) | |||
Application-Defined or Object-Defined Error on simple code | Excel Programming | |||
Application-defined or object-defined error on copy | Excel Programming | |||
Application-defined or object-defined error - missing the basics | Excel Programming | |||
Macro Run-time Error 1004 Application Defined or Object Defined Error | Excel Programming |