1
votes

I am trying to delete Column A,B,D,E,F,W,X,Y,Z,AA,AB of the sheet FeuilleFP21. In order to do this I use as seen here and here:

FeuilleFP21.Range("A:B,D:F,W:AB").Delete

But it gives me the following error :

Execution error '1004': The 'Range' method of the '_Worksheet' object failed.

NOTE : FeuilleFP21 is set like that and in Execution window return the name of the sheet when I use ? ?FeuilleFP21.Name

Set FeuilleFP21 = ClasseurFp21.Worksheets(1)

What am I doing wrong ?

1
Try to record a macro, deleteing these columns, see the code and repeat it. - Vityata
@Vityata are the answer with tons of upvote false ? - TourEiffel
@Vityata When I do it manually it does the same but using .Select .. Range("A:B,D:F,W:AB").Select Selection.Delete - TourEiffel
It works for me when I tested. Though if I write the string incorrectly I get the same error (used ; instead of , first since this is the list separator on my system). Note that Delete will completely remove the entire columns while Clear will just delete all content. It may be that something is preventing the columns from being deleted? - Petter
Now write ?ActiveSheet.CodeName and try with this one instead of FeuilleFP21. - Vityata

1 Answers

2
votes

System settings may cause the error. Try separating the columns with ; or whatevery you may have as a "List separator" on your system.