Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Delete the contents of all cells which dont contain formulae

Please can anyone help with a method of deletiong all values except formulae
from a range of cells in single and multiple worksheets?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default Delete the contents of all cells which dont contain formulae

One way:

Choose Edit/Go To.../Special, select Constants from the dialog. Then
Edit/Clear All.

In article ,
Warby wrote:

Please can anyone help with a method of deletiong all values except formulae
from a range of cells in single and multiple worksheets?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,718
Default Delete the contents of all cells which dont contain formulae

First save your workbook.

Hit F5 Special select Constants OK out while highlight all values
press Delete key


"Warby" wrote:

Please can anyone help with a method of deletiong all values except formulae
from a range of cells in single and multiple worksheets?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Delete the contents of all cells which dont contain formulae

Select your range of cells and run:

Sub clear_val()
For Each r In Selection
If r.HasFormula Then
Else
r.Clear
End If
Next
End Sub


repeat for other worksheets
--
Gary''s Student - gsnu200765


"Warby" wrote:

Please can anyone help with a method of deletiong all values except formulae
from a range of cells in single and multiple worksheets?

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Delete the contents of all cells which dont contain formulae

Select the range first--be sure not to include the cells that contain labels
that you want to keep (headers/instructions).

Then edit|Goto|Special|Constants
and click ok.
The original selection will be reduced to just the cells that contain constants.
Then hit the delete key on the keyboard.

In code, you can loop through the worksheets like:

Option Explicit
Sub testme()
Dim wks As Worksheet

On Error Resume Next
For Each wks In ActiveWorkbook.Worksheets
wks.Cells.SpecialCells(xlCellTypeConstants).ClearC ontents
Next wks
On Error GoTo 0
End Sub

But this will clear the contents of all cells with values--including headers.
I'd be careful.

Warby wrote:

Please can anyone help with a method of deletiong all values except formulae
from a range of cells in single and multiple worksheets?


--

Dave Peterson


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
Delete contents unlocked cells RobN[_3_] Excel Discussion (Misc queries) 9 December 13th 07 10:34 PM
Delete contents in cells with macro dford Excel Discussion (Misc queries) 4 February 4th 07 12:39 PM
Delete contents of cells mikespeck Excel Worksheet Functions 3 July 27th 06 03:16 PM
How do I delete the contents of unprotected cells only? Dan Excel Discussion (Misc queries) 3 August 8th 05 08:18 PM
Delete contents of unprotected cells in workbook BD7447 Excel Worksheet Functions 1 November 6th 04 05:41 PM


All times are GMT +1. The time now is 03:12 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"