Delete

T

Tim

Hello All,
I would like to write some code that goes through all the
worksheets in a book and deletes any "hard-coded"
numbers. I would like it to leave all the titles and
headings and formulas.

Thanks in advance
 
N

Norman Jones

Hi Tim,

Try:

Sub TesterA01()
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
On Error Resume Next
ws.Cells.SpecialCells(xlConstants, _
xlNumbers).Delete
On Error GoTo 0
Next ws
End Sub
 
T

Tom Ogilvy

for each sh in workbook.worksheets
On error resume next
sh.cells.specialcells(xlconstants,xlnumbers).ClearContents
On error goto 0
Next

would be a start.
 
N

Norman Jones

Too hasty in correcting the typo!
Change Delete to ClearConteb=nts.


Should be:

Change Delete to ClearContents


The original typo was a stupidity on my part, probably due to a subconscious
retention of the the title of your post.
 
Top