Solved

Clear Content of cells

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

839 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