Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Selection.ClearContents for data only

Is it possible to clear the data without clearing the formulas?

I have an area of the sheet which is mostly data which needs to be cleared
before updating. A few cells have formulas attached.

Rich


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Selection.ClearContents for data only

One way:

On Error Resume Next 'in case no constants
Selection.Cells.SpecialCells(xlCellTypeConstants). ClearContents
On Error GoTo 0


In article ,
"Richard Lawson" wrote:

Is it possible to clear the data without clearing the formulas?

I have an area of the sheet which is mostly data which needs to be cleared
before updating. A few cells have formulas attached.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Selection.ClearContents for data only

maybe something like this:

Sub Test()
ActiveSheet.Cells.SpecialCells(xlCellTypeConstants ).Clear
End Sub


--
Hope that helps.

Vergel Adriano


"Richard Lawson" wrote:

Is it possible to clear the data without clearing the formulas?

I have an area of the sheet which is mostly data which needs to be cleared
before updating. A few cells have formulas attached.

Rich



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
after clearcontents() new data is positioned below the cleared ran Rea Peleg Excel Programming 5 June 21st 05 02:46 PM
wrong positioning of data in sheet after clearcontents() Rea Excel Programming 1 June 21st 05 12:22 PM
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 08:59 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"