Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Modify ClearContents

I have a workbook with two worksheets, namely Archive and Data.

The following code clears all the cell in the Archive worsheet when a click event is
started.

As all cells are cleared, it wipes out any formulae as well!

How would I have to modify the code so that it only cleared lines 1 to 500, or
certain cells?

Sheets("Archive").Select
Sheets("Archive").Cells.Select
Selection.ClearContents

TIA.

--

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Modify ClearContents

I cann't help with deleting 'certain cells' unless you are specific but this
will delete rows 1 thu 500

Sub deleteme()
Sheets("Archive").Select
Rows("1:500").Select
Selection.ClearContents
End Sub

"Saxman" wrote:

I have a workbook with two worksheets, namely Archive and Data.

The following code clears all the cell in the Archive worsheet when a click event is
started.

As all cells are cleared, it wipes out any formulae as well!

How would I have to modify the code so that it only cleared lines 1 to 500, or
certain cells?

Sheets("Archive").Select
Sheets("Archive").Cells.Select
Selection.ClearContents

TIA.

--


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Modify ClearContents

Worksheets("Archive").Range("A1:IV500").specialCel ls(xlConstants).ClearContents

--
Regards,
Tom Ogilvy



"Saxman" wrote:

I have a workbook with two worksheets, namely Archive and Data.

The following code clears all the cell in the Archive worsheet when a click event is
started.

As all cells are cleared, it wipes out any formulae as well!

How would I have to modify the code so that it only cleared lines 1 to 500, or
certain cells?

Sheets("Archive").Select
Sheets("Archive").Cells.Select
Selection.ClearContents

TIA.

--


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Modify ClearContents

Mike wrote:

I cann't help with deleting 'certain cells' unless you are specific but this
will delete rows 1 thu 500

Sub deleteme()
Sheets("Archive").Select
Rows("1:500").Select
Selection.ClearContents
End Sub

'
I get a RunTime error with the above Rows("1:500").Select'.
--

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Modify ClearContents

Tom Ogilvy wrote:

Worksheets("Archive").Range("A1:IV500").specialCel ls(xlConstants).ClearContents


Where exactly do I paste the above in the code and what does IV signify?

Thanks.

--



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Modify ClearContents

Saxman wrote:

Tom Ogilvy wrote:

Worksheets("Archive").Range("A1:IV500").specialCel ls(xlConstants).ClearContents


Where exactly do I paste the above in the code and what does IV signify?


I got it woking now!

Thanks.
--

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
clearcontents for some columns of a row Scott Excel Programming 3 May 16th 06 05:55 PM
ClearContents not clearing :( JoeH[_21_] Excel Programming 0 September 27th 04 02:54 AM
Clearcontents Caroline Vincent Excel Programming 2 September 9th 04 11:03 AM
Clearcontents K Dales Excel Programming 0 February 27th 04 01:52 PM
Clearcontents Dick Kusleika[_3_] Excel Programming 0 February 17th 04 05:42 PM


All times are GMT +1. The time now is 04:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"