Results 1 to 2 of 2

Thread: How to completely delete the content of the enire sheet

  1. #1
    Senior Member
    Join Date
    Apr 2011
    Posts
    190
    Rep Power
    14

    How to completely delete the content of the enire sheet

    The code below is what I use to clear my sheet -

    Code:
    ActiveSheet.UsedRange.ClearContents
    However when I then execute the code below - only the data is cleared - so in effect the column/row counts still are in place - what is the best best way to not only clear the sheet - but also clear the column/row count. I have ActiveX controls (not form controls) directly on my sheet - but those I want to keep.


    If I have to - I can add the ActiveX controls via code - after I clear the sheet - but would prefer not to do that.





    Code:
    With ActiveSheet.UsedRange
            LastRow = .Rows(.Rows.Count).Row
            ColLast = .Columns(.Columns.Count).Column
       End With
    xl2007 - Windows 7
    xl hates the 255 number

  2. #2
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi

    Use
    Code:
    ActiveSheet.UsedRange.Clear
    Then save the workbook.
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

Similar Threads

  1. Replies: 5
    Last Post: 04-18-2013, 02:30 AM
  2. Replies: 2
    Last Post: 12-26-2012, 08:31 AM
  3. Excel found unreadable content
    By zyousafi in forum Excel Help
    Replies: 2
    Last Post: 08-08-2012, 10:41 AM
  4. Delete Sheet If Contains
    By rabidfly in forum Excel Help
    Replies: 5
    Last Post: 06-25-2012, 01:02 PM
  5. Replies: 2
    Last Post: 11-17-2011, 07:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •