Heder_Santos
New Member
- Joined
- Jun 5, 2015
- Messages
- 12
Hello everyone
I'm currently having some issues when trying to delete multiple columns in a worksheet, it shows "Error 1004", and stops the macro.
But when I press F8 after the editor highlights that line of code, it works fine and deletes the columns...
Every time I try to do this in the Sub (it happens 4 times more in other worksheets) I get this error and the same thing happens when I press F8.
Could someone please help me? I've searched here and at other forums but I haven't found someone with a problem like this.
Here are the lines of Code im Using:
WSO.Activate 'Activates the Worksheet
Range("A:A, J:M, U:U, AA:AB, AG:AG, AP:AS, AV:AW, AY:CH").EntireColumn.Delete
'I've tried to use delete (with and without "xlToLeft"), tried to reduce the amount of columns, tried to call a different Sub deleting the range, and nothing worked
'Range("A:A, J:M, U:U, AA:AB, AG:AG, AP:AS, AV:AW, AY:BP, BQ:CI").Delete xlToLeft
'Range("A:A, J:M, U:U, AA:AB, AG:AG").Delete xlToLeft
'Range("AG:AJ, AM:AN,AP:BY").Delete xlToLeft
Thanks
I'm currently having some issues when trying to delete multiple columns in a worksheet, it shows "Error 1004", and stops the macro.
But when I press F8 after the editor highlights that line of code, it works fine and deletes the columns...
Every time I try to do this in the Sub (it happens 4 times more in other worksheets) I get this error and the same thing happens when I press F8.
Could someone please help me? I've searched here and at other forums but I haven't found someone with a problem like this.
Here are the lines of Code im Using:
WSO.Activate 'Activates the Worksheet
Range("A:A, J:M, U:U, AA:AB, AG:AG, AP:AS, AV:AW, AY:CH").EntireColumn.Delete
'I've tried to use delete (with and without "xlToLeft"), tried to reduce the amount of columns, tried to call a different Sub deleting the range, and nothing worked
'Range("A:A, J:M, U:U, AA:AB, AG:AG, AP:AS, AV:AW, AY:BP, BQ:CI").Delete xlToLeft
'Range("A:A, J:M, U:U, AA:AB, AG:AG").Delete xlToLeft
'Range("AG:AJ, AM:AN,AP:BY").Delete xlToLeft
Thanks