ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error 1004 when selecting a range (https://www.excelbanter.com/excel-programming/303196-error-1004-when-selecting-range.html)

Matt J

Error 1004 when selecting a range
 
I have the following code in a Macro and it works fine. When I copy it to a click event for command button I get a Run-time error 1004 "Select Method of Range class failed.

Sheets("SOAUDITSO").Select
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp

What am I doing wrong?

Matt J

Error 1004 when selecting a range
 
Sorry for the duplicate I got an error when it was posting


"Matt J" wrote:

I have the following code in a Macro and it works fine. When I copy it to a click event for command button I get a Run-time error 1004 "Select Method of Range class failed.

Sheets("SOAUDITSO").Select
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp

What am I doing wrong?



All times are GMT +1. The time now is 07:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com