Solved

Clear Content of cells

Posted on 2011-02-27
5
554 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This is about my first experience with programming Arduino.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now