PC Review


Reply
Thread Tools Rate Thread

Clear Contents of all Sheets

 
 
timmie7004@yahoo.co.uk
Guest
Posts: n/a
 
      18th Mar 2008
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
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      18th Mar 2008
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

"(E-Mail Removed)" 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
>

 
Reply With Quote
 
timmie7004@yahoo.co.uk
Guest
Posts: n/a
 
      18th Mar 2008
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 With Quote
 
Dana DeLouis
Guest
Posts: n/a
 
      18th Mar 2008
Once your workbook is clear, see if saving your workbook as a "Template"
might be an option for you.

--
Dana DeLouis

<(E-Mail Removed)> wrote in message
news:1e4e1bee-7d85-4e23-b0d6-(E-Mail Removed)...
> 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 With Quote
 
Mike H
Guest
Posts: n/a
 
      18th Mar 2008
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

"(E-Mail Removed)" 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clear Contents gibbylinks Microsoft Excel Setup 5 12th Oct 2009 05:04 PM
clear contents re value Curt Microsoft Excel Programming 9 1st Jun 2009 04:02 PM
Clear Contents =?Utf-8?B?U3RldmVk?= Microsoft Excel Programming 4 15th Oct 2007 11:16 PM
Macro to clear range contents when cell contents are changed by us =?Utf-8?B?U3RldmUgRQ==?= Microsoft Excel Programming 12 22nd Feb 2007 09:09 PM
Clear contents =?Utf-8?B?U2FtYW50aGFL?= Microsoft Excel Programming 3 15th Jun 2006 09:05 AM


Features
 

Advertising
 

Newsgroups
 


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