+ Reply to Thread
Results 1 to 4 of 4

VBA delete the Table Body in 4 tables new sheet, leave headers & subtotals.

  1. #1
    Forum Contributor
    Join Date
    11-30-2005
    Location
    Penzance Cornwall, UK
    MS-Off Ver
    Office 365
    Posts
    198

    VBA delete the Table Body in 4 tables new sheet, leave headers & subtotals.

    Hi Guys,

    The title nearly explains all.

    I have a sheet with 4 tables and some buttons. One of the buttons is "Add New Sheet"

    I would like to code said button to copy the sheet to the end, delete the 4 tables bodies "leaving" the 4 headers and the 4 subtotals.

    The 4 sheet names are Transport, Boat, Provisions & Misc, but with numbers after each one, for example, on one sheet it is Transport220 and on the next it is Transport224283236404448 and the next Transport2242832364044482 (I don't know what that is all about, Excel did it).

    Looking forward to a solution,

    Keith

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: VBA delete the Table Body in 4 tables new sheet, leave headers & subtotals.

    This is probably not what you are looking for, but look at it.
    ("the 4 headers and the 4 subtotals" is a bit enigmatic).
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    11-30-2005
    Location
    Penzance Cornwall, UK
    MS-Off Ver
    Office 365
    Posts
    198

    Re: VBA delete the Table Body in 4 tables new sheet, leave headers & subtotals.

    Thank you for your reply, not "exactly" what I was looking for.

    With the 4 tables, Transport, Boat, Provisions & Misc, I would like to keep the "Header" row & "Total" row of each table, but, remove each of the tables data rows.

    Ok, I found this code that works, sort of. Because I am using these tables on lots of sheets, each table has lots of numbers following its name and these change from sheet to sheet as can be seen below, Transport has become Transport9273135394347519 on the sheet I am "playing" with.

    So, this seems to do what I require for "1" table on "1" sheet.

    Can anyone modify this code to something a little more generic that will work on any sheet?

    Please Login or Register  to view this content.
    Last edited by kjg; 12-07-2017 at 06:02 AM.

  4. #4
    Forum Contributor
    Join Date
    11-30-2005
    Location
    Penzance Cornwall, UK
    MS-Off Ver
    Office 365
    Posts
    198

    Re: VBA delete the Table Body in 4 tables new sheet, leave headers & subtotals.

    Hi Guys,

    Just thought I'd share with you, I think I have found the solution to my problem.

    The code below "seems" to do what I require.


    Please Login or Register  to view this content.

+ 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. autofilter method of range class failed -header has tables headers and non table headers
    By naveen.acheanz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-16-2016, 08:21 AM
  2. [SOLVED] Copy Pivot into Table - - headers going into Table body
    By michellepace in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-29-2016, 08:39 PM
  3. Replies: 0
    Last Post: 10-01-2014, 05:55 PM
  4. [SOLVED] Inputting new Headers and pulling data from other tables (same WB) into main table
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-30-2014, 02:38 PM
  5. [SOLVED] Delete All Blank Columns with Sheet that has Headers
    By desertshore in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-12-2013, 06:55 PM
  6. Sort specific rows and leave headers
    By sp1ken in forum Excel General
    Replies: 2
    Last Post: 05-12-2009, 10:29 AM
  7. Delete filtered data, leave headers, error
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-05-2009, 12:22 PM

Tags for this Thread

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