+ Reply to Thread
Results 1 to 6 of 6

Cut & Paste columns, if columns contains a certain value

  1. #1
    Forum Contributor
    Join Date
    01-04-2016
    Location
    Newcastle
    MS-Off Ver
    2016
    Posts
    107

    Smile Cut & Paste columns, if columns contains a certain value

    So i want to cut and paste columns if it contains a value, for example if my column contained the word 'dog', it would cut the entire column and paste the column one column to the right. Confusing, so i'll post a couple of images of what i want:

    Before:

    1.png

    After:

    2.png

  2. #2
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Cut & Paste columns, if columns contains a certain value

    Hello
    With your sample data in columns A:K, then try something like:
    Please Login or Register  to view this content.
    This seems to work given your sample layout.

    DBY
    Last edited by DBY; 12-01-2016 at 08:48 AM. Reason: Amended code.

  3. #3
    Forum Contributor
    Join Date
    01-04-2016
    Location
    Newcastle
    MS-Off Ver
    2016
    Posts
    107

    Re: Cut & Paste columns, if columns contains a certain value

    That's great, but i need it to work if the cell contains other data, so for example if the cell contained "sdsadsadas dog 1213213", I'd need the code still to run.

    I tried using this, but it didn't work:

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Cut & Paste columns, if columns contains a certain value

    This modification to DBY's code may help.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    01-04-2016
    Location
    Newcastle
    MS-Off Ver
    2016
    Posts
    107

    Re: Cut & Paste columns, if columns contains a certain value

    Spot on. Thanks for the help guys.

  6. #6
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Cut & Paste columns, if columns contains a certain value

    Glad we could help. Thanks for the rep mark.

+ 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] Macros - Delete Columns, Cut & Paste Columns then Sorted by Column
    By M12NIX in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-17-2015, 10:49 AM
  2. [SOLVED] Copy data from multiple columns and paste into single columns
    By daniel_t in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2015, 11:20 AM
  3. Macro to Copy from 2 Columns, Paste Value in the next 2 Columns, Then clear 1st Columns
    By MHALTTUNEN in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-22-2014, 03:34 PM
  4. Replies: 4
    Last Post: 03-02-2014, 11:55 AM
  5. macro to add columns after existing columns and copy/paste headers and formulas
    By rhybeka in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2013, 02:35 PM
  6. [SOLVED] Copy/Paste multiple columns as values based on another columns criteria
    By Dgp2012 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-28-2013, 06:50 AM
  7. [SOLVED] Faster way to copy and paste multiple columns in Sheet1 to corresponding columns in Sheet2
    By babbeleme1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-19-2013, 12:55 AM

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