Solved

Clear Content of cells

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

757 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

18 Experts available now in Live!

Get 1:1 Help Now