Solved

Clear Content of cells

Posted on 2011-02-27
5
573 Views
Last Modified: 2012-06-21
I have my code coping over data from a previoud sheet. now i need the code to clear a differint range of cells
dteToday = InputBox("Enter todays date:")  
Set objPreviousSheet = ActiveSheet  
objPreviousSheet.Copy , ActiveWorkbook.Sheets(ActiveWorkbook.Sheets.Count)  
Set objNewSheet = ActiveWorkbook.Sheets(ActiveWorkbook.Sheets.Count)  
objNewSheet.Name = dteToday  
objPreviousSheet.Range("F11:F16,H11:H16,J11:J16,L11:L16,N11:N16,P11:P16,R11:R16").Copy objNewSheet.Range("AA11:AG16")
objPreviousSheet.Range ("E11:E16,G11:G16,I11:I16,K11:K16,M11:M16,O11:O16,Q11:Q16").ClarContent

Open in new window

0
Comment
Question by:joshuajoseph09
  • 2
5 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34992146
You already seem to have it .. albeit a typo you need clearcontents as the final command in te line

Chris
0
 
LVL 6

Accepted Solution

by:
TinTombStone earned 250 total points
ID: 34992182
for a particulat range
objPreviousSheet.Range("A1:A10").ClearContents

or for non-adjacent ranges
objPreviousSheet.Range("A1,A3,A4,A10,F45").ClearContents

or  for the whole sheet
objPreviousSheet.Cells.ClearContents

or for the whole used range
objPreviousSheet.UsedRange.Clear

or for the current datarange
objPreviousSheet.ActiveCell.CurrentRegion.ClearContents
0
 
LVL 59

Assisted Solution

by:Chris Bottomley
Chris Bottomley earned 250 total points
ID: 34992238
Note Clearcontents as you seem to have started with will clear the data whereas .clear will clear the contents and also any formatting applied to the cell.

Chris
0
 
LVL 24

Expert Comment

by:broomee9
ID: 35225366
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question