Clear Contents

Robert Wyatt

Board Regular
Joined
Jul 15, 2012
Messages
84
Office Version
  1. 2019
Platform
  1. Windows
I would like to know how to write a macro to clear contents in two different spreadsheets with different cells. In the first sheet, I would like to clear the contents in A7, C19:E33, and A36:E36. Then in the second sheet, I would like to Clear the Contents in Cells H34:H35. and H45:H46. I have tired using Sub Clear Contents() Worksheet("1").Range(then the cell range).Clearcontents and Worksheet("1").Range(then the cell range).Clearcontents, but it's not working. any help would be greatly Appersaited.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
What exactly did you try and what happened? You need Worksheets not Worksheet but other than that it should work if everything else was correct (and assuming no merged cells).
 
Upvote 0
Solution
never noticed that I didn't put an s on worksheets went back and placed the s and it works thanks.
 
Upvote 0

Forum statistics

Threads
1,215,096
Messages
6,123,074
Members
449,093
Latest member
ripvw

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