+ Reply to Thread
Results 1 to 7 of 7

Only copying/deleting columns from a table rather than the entire sheet

  1. #1
    Registered User
    Join Date
    09-26-2014
    Location
    United States
    MS-Off Ver
    Office 2010
    Posts
    25

    Only copying/deleting columns from a table rather than the entire sheet

    Hello!

    Basically what I am looking for is how to make this macro not copy the entire row of data but only copy/paste/delete the columns from the table (A:Y).

    Here is the current macro:

    Please Login or Register  to view this content.


    I will also attach the current spreadsheet so that you can get a better idea of what I am looking for. The reason I only want the table columns to be deleted is because anytime that I have to move an employee to the Terms tab, it moves up the dates that everything is calculated off of by 1, and causes issues with the rest of the sheet.

    Thanks for any help you are able to give me as always.

    2015 PTO tracker Hourly WIP.xlsm
    Last edited by Glade1825; 03-01-2015 at 08:24 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2403 Win 11 Home 64 Bit
    Posts
    23,810

    Re: Only copying/deleting columns from a table rather than the entire sheet

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    09-26-2014
    Location
    United States
    MS-Off Ver
    Office 2010
    Posts
    25

    Re: Only copying/deleting columns from a table rather than the entire sheet

    Sorry about that. Should be fixed now!

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Only copying/deleting columns from a table rather than the entire sheet

    Moderator request has been fulfilled so I will respond to post.

    This line here, as it says specified the whole row to be copied

    Please Login or Register  to view this content.
    There are a couple of ways to specify specific ranges to be addressed. One way would be like this

    Please Login or Register  to view this content.
    This will cover columns A to Y. Give this a try and let me know. Note: I only looked at your code, not your workbook because I think this solves you question. If it does not let me know and i will delve further into it.

  5. #5
    Registered User
    Join Date
    09-26-2014
    Location
    United States
    MS-Off Ver
    Office 2010
    Posts
    25

    Re: Only copying/deleting columns from a table rather than the entire sheet

    Hi, I believe this would work but I get an error when I attempt Term someone the goes as follows:

    "This operation is not allowed. The operation is attempting to shift cells in a table in your worksheet."

    I assume that I would need to modify the end of the code to shift cells up after deleting but I am not sure how to do that.

  6. #6
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Only copying/deleting columns from a table rather than the entire sheet

    when I attempt Term someone the goes as follows:

    "This operation is not allowed. The operation is attempting to shift cells in a table in your worksheet."
    What?!?

    I assume that I would need to modify the end of the code to shift cells up after deleting but I am not sure how to do that.
    The default of .Delete is to shift cell up. If you want to specify for safety sake you could do this

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-26-2014
    Location
    United States
    MS-Off Ver
    Office 2010
    Posts
    25

    Re: Only copying/deleting columns from a table rather than the entire sheet

    Well that error message still comes up, but it is not a big deal. I can just convert the table to range and it will work fine with filters. Once I do that it works the way I would like it to so thank you for your help! I greatly appreciate it.

+ 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] Comparing data in two different columns and deleting entire row
    By Erik_with_a_K in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2013, 11:42 AM
  2. [SOLVED] Copying the entire row from TABLE A that meets certain criteria to another Table
    By jjin in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-17-2012, 08:56 PM
  3. Macro is deleting entire table when no values return in a criteria.
    By narrowgate88 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-07-2012, 11:32 AM
  4. Deleting An Entire Row if Date is not Today in Any One of Three Columns
    By gafree01 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-18-2012, 09:58 PM
  5. Macro for Deleting the entire row if first two columns are blank
    By Nithya1987 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-08-2011, 12:24 PM

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