+ Reply to Thread
Results 1 to 5 of 5

Search through single row for string then cut and paste whole column

  1. #1
    Registered User
    Join Date
    01-14-2009
    Location
    Earth
    MS-Off Ver
    2007
    Posts
    43

    Search through single row for string then cut and paste whole column

    I've been working on this trying to piece together code I've found in several searches. What I am trying to do is just search "A1:Z1" for five different strings (this is my header row). Once the string is found, I want the whole column to be cut and pasted in a specific order each time.

    I don't really know VBA but can usually do some reading to find out how to get the job done but this time I think this is a little beyond me.

    Here is what I have so far:

    Please Login or Register  to view this content.
    Last edited by flipjarg; 06-24-2013 at 11:24 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Where exactly do you want the columns to go?
    If posting code please use code tags, see here.

  3. #3
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Search through single row for string then cut and paste whole column

    Try this - I assumed that in the end you want String1 in the front and String 5 in the end - if you want it the other way around, change "For i = 5 to 1 Step -1" to "For i = 1 to 5"

    Please Login or Register  to view this content.
    Please click the * below if this helps
    Please click the * below if this helps

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Search through single row for string then cut and paste whole column

    This will find all the headers and then paste them into Sheet2 in order, starting from column A.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-14-2009
    Location
    Earth
    MS-Off Ver
    2007
    Posts
    43

    Re: Search through single row for string then cut and paste whole column

    Thank you for all the replies and code! I forgot to mention that some of the columns contain formulas so JasperD's is the one I'm ending up using. However, I am storing all of these away for future use since they all did what they were intended to. Thanks for the help !

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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