ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Delete content but not formulas (https://www.excelbanter.com/excel-discussion-misc-queries/225462-delete-content-but-not-formulas.html)

Jake F

Delete content but not formulas
 
I was asked if there is a way to remove the content of spreadsheets but to
keep the formulas. I'm not sure why the person wants to do this, but want to
give them a correct answer. Thanks.

Tim Zych

Delete content but not formulas
 
To remove values only from Excel:
Select all cells on the worksheet, or just one cell.
Press F5 (or Ctrl + G or Edit - Goto)
Click the "Special" button.
Click "Constants"
Numbers, Text, Logicals, Errors should be checked.
Click OK.
Press Del (or Edit - Clear - Contents)
Repeat for other worksheets as needed.

Or use a macro -- for just the active sheet:
Sub RemoveValuesOnly()
Dim cell As Range
For Each cell In ActiveSheet.UsedRange.Cells
If Not cell.HasFormula Then
cell.ClearContents
End If
Next
End Sub

Or for every worksheet in the active workbook:
Sub RemoveValuesOnly()
Dim cell As Range, wks As Worksheet
For Each wks In ActiveWorkbook.Worksheets
For Each cell In wks.UsedRange.Cells
If Not cell.HasFormula Then
cell.ClearContents
End If
Next
Next
End Sub

--
Tim Zych
http://www.higherdata.com
Workbook Compare - Excel data comparison utility
Free and Pro versions


"Jake F" wrote in message
...
I was asked if there is a way to remove the content of spreadsheets but to
keep the formulas. I'm not sure why the person wants to do this, but want
to
give them a correct answer. Thanks.




Bernard Liengme[_3_]

Delete content but not formulas
 
Use Edit| GoTo Special; specify Constants and tap the Delete key
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Jake F" wrote in message
...
I was asked if there is a way to remove the content of spreadsheets but to
keep the formulas. I'm not sure why the person wants to do this, but want
to
give them a correct answer. Thanks.





All times are GMT +1. The time now is 10:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com