Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Clear Contents of all Sheets

How would I clear the contents of all Sheets in my file? I can record
a macro that will clear the contents of a specific, but I have
multiple sheets and was wondering if there is a nice easy way

Newbie here

Thanks

Timmie
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Clear Contents of all Sheets

Hi,

If you going to do that why not simply delete the workbook. But if you want
another method use this. BEWARE it will delete everything so make sure thats
what you want. Alt+Fll to open Vb editor. Right click a worksheet tab, view
code and psate this in.

Sub clearall()
Dim ws As Worksheet
For x = 1 To ThisWorkbook.Worksheets.Count
Worksheets(x).UsedRange.ClearContents
Next
End Sub

Mike

" wrote:

How would I clear the contents of all Sheets in my file? I can record
a macro that will clear the contents of a specific, but I have
multiple sheets and was wondering if there is a nice easy way

Newbie here

Thanks

Timmie

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Clear Contents of all Sheets

Thank you Mike that works a dream. Didn't want to delete the
worksheets as I have formats setup, so each week I copy in different
data (but require the same formats)

Tim
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default Clear Contents of all Sheets

Once your workbook is clear, see if saving your workbook as a "Template"
might be an option for you.

--
Dana DeLouis

wrote in message
...
Thank you Mike that works a dream. Didn't want to delete the
worksheets as I have formats setup, so each week I copy in different
data (but require the same formats)

Tim


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Clear Contents of all Sheets

Hi,

Glad that helped and thanks for the feedback. BTW my response was a cut from
another sub and I included this line which isn't necessary
Dim ws As Worksheet

Mike

" wrote:

Thank you Mike that works a dream. Didn't want to delete the
worksheets as I have formats setup, so each week I copy in different
data (but require the same formats)

Tim



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
Clear Contents Secret Squirrel Excel Discussion (Misc queries) 1 February 3rd 09 12:37 AM
Clear Contents Steved Excel Programming 4 October 15th 07 11:16 PM
Clear Contents Richard Excel Programming 5 September 11th 07 01:34 PM
Macro to clear range contents when cell contents are changed by us Steve E Excel Programming 12 February 22nd 07 09:09 PM
Clear contents SamanthaK Excel Programming 3 June 15th 06 09:05 AM


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