+ Reply to Thread
Results 1 to 11 of 11

Clear sheets using VBA

  1. #1
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Clear sheets using VBA

    Hi all,

    I was wondering if there is a better way of tweaking of my below code to see if I can dynamically clear content in my active sheet leaving first ROW.

    below is the code

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: Clear sheets using VBA

    Hello HudsonAndrew,

    Try the following:-


    Please Login or Register  to view this content.
    I hope that this helps.

    Cheerio,
    vcoolio.

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Clear sheets using VBA

    Hi Hudson Andrew,

    Try:
    Please Login or Register  to view this content.
    NOTE: .ClearContents removes data only. .Clear removes data and all formatting.

    Lewis
    Last edited by AliGW; 01-02-2018 at 10:35 AM. Reason: Code tags!!!

  4. #4
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Clear sheets using VBA

    Hi guys ..

    thanks for the code its is working fine but need small changes , i am actually dealing with tables , above code only clearing the content i want everything to be cleared .

    example : i want table content and its rows and its format to be cleared .

    thanks !
    Hudson

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Clear sheets using VBA

    Hi,

    This will clear the table range leaving only the headers intact and resize the table
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,882

    Re: Clear sheets using VBA

    If you want to clear multiple tables in activesheet, except for header rows.

    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  7. #7
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Clear sheets using VBA

    Hey guys , this is fantastic . its is working one more small tweek what if i wanted to keep first two rows and delete everything , how do i change the code to ?.

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,882

    Re: Clear sheets using VBA

    How do you mean?

    Do you need first row of data kept + header?
    Or just the 2 rows of data range with or without data?

  9. #9
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Clear sheets using VBA

    yes, i need below .

    Do you need first row of data kept + header?

    i want one header and one row data rest everything needs to be cleared including formats .

    Thanks ..

  10. #10
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,882

    Re: Clear sheets using VBA

    Something like below?
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Clear sheets using VBA

    This is really greate mate , it worked thanks .

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Clear All Sheets Except First/Specific Name
    By Wheelie686 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-11-2016, 07:22 PM
  2. [SOLVED] Clear Sheets All at Once (without looping)
    By cmore in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-27-2015, 04:09 PM
  3. [SOLVED] Clear cells on multiple sheets
    By Jazzmann in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2015, 10:50 PM
  4. [SOLVED] Looping through sheets to clear a specified range, but excluding some sheets
    By d.sanchez in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-03-2013, 02:39 PM
  5. VBA to clear cell across all sheets in a workbook.
    By BradyBunches in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-04-2011, 08:00 PM
  6. Clear Multiple sheets
    By kithing in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-22-2010, 01:48 PM
  7. [SOLVED] Clear Sheets in Excel
    By Emily in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-27-2006, 11:30 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1