Clear Contents

gmazza76

Well-known Member
Joined
Mar 19, 2011
Messages
771
Office Version
  1. 365
Platform
  1. Windows
Good Afternoon,

I am using a Macro to copy information to another sheet, which is working but i am now trying to clear the cells that have been copied.

The data is copied from a sheet called "Advocate Quality" to another, but i am having issues with the code.
The first line below works ok, but as i am trying to clear a range with the bottom 3 lines of VB it debugs. Can anyone point me in the right direction as i did just try adding Sheets("Amend Quality") in front of the range and removing range and it didnt work

Code:
Sheets("Amend Quality").Cells(97, 11).ClearContents     

Range(Cells(22, 2), Cells(25, 11)).ClearContents 
Range(Cells(37, 2), Cells(40, 11)).ClearContents 
Range(Cells(50, 2), Cells(53, 11)).ClearContents

Many Thanks
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Try

Code:
With Sheets("Amend Quality")
    .Cells(97, 11).ClearContents
    .Range(.Cells(22, 2), .Cells(25, 11)).ClearContents
    .Range(.Cells(37, 2), .Cells(40, 11)).ClearContents
    .Range(.Cells(50, 2), .Cells(53, 11)).ClearContents
End With
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,762
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top