Phil Chamberlain
Phil Chamberlain

Reputation: 35

Why can't I delete a sheet after copying it?

I have code which is created in an excel document as it can be 300 lines which are all similar, I would like to copy a range from one sheet to another then delete that second sheet. I managed to copy from one sheet to another but my delete isn't working I need to do this all on one line.

This is what I have done

Sheets("100614_2019010915_1min").Range("A2:Q60").Copy Destination:=Sheets("100614_2019010914_1min").Range("A61").Sheets("100614_2019010915_1min").Delete

Upvotes: 0

Views: 47

Answers (2)

Cyril
Cyril

Reputation: 6829

I believe you watned this:

Sheets("100614_2019010915_1min").Range("A2:Q60").Copy Sheets("100614_2019010914_1min").Range("A61")
Sheets("100614_2019010915_1min").Delete

Upvotes: 2

Error 1004
Error 1004

Reputation: 8230

Try:

Sheets("100614_2019010915_1min").Range("A2:Q60").Copy 
Destination:=Sheets("100614_2019010914_1min").Range("A61")
Sheets("100614_2019010915_1min").Delete

OR:

Sheets("100614_2019010915_1min").Range("A2:Q60").Copy Sheets("100614_2019010914_1min").Range("A61")
Sheets("100614_2019010915_1min").Delete

Upvotes: 1

Related Questions