#1   Report Post  
Posted to microsoft.public.excel.programming
tim tim is offline
external usenet poster
 
Posts: 105
Default Delete

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Delete

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


---
Regards,
Norman



"Tim" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Delete

Hi Tim,

Typo:

Change Delete to ClearConteb=nts.


---
Regards,
Norman



"Norman Jones" wrote in message
...
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


---
Regards,
Norman



"Tim" wrote in message
...
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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Delete

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.

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Tim,

Typo:

Change Delete to ClearConteb=nts.


---
Regards,
Norman



"Norman Jones" wrote in message
...
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


---
Regards,
Norman



"Tim" wrote in message
...
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







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete

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

would be a start.

--
Regards,
Tom Ogilvy

"Tim" wrote in message
...
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





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 the test values, but do not delete the formulas kathy Excel Discussion (Misc queries) 1 February 21st 07 07:03 PM
How to Delete a Range in Closed Workbook (to Replace Delete Query) [email protected] Excel Discussion (Misc queries) 1 March 8th 06 10:10 AM
How do i delete a macro in Excel 2003 when delete isn't highlight Abel Excel Discussion (Misc queries) 2 September 13th 05 04:09 AM
How to delete rows when List toolbar's "delete" isnt highlighted? Linda Excel Worksheet Functions 1 May 26th 05 08:39 PM


All times are GMT +1. The time now is 01:18 PM.

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

About Us

"It's about Microsoft Excel"