+ Reply to Thread
Results 1 to 8 of 8

Error with multiple search/copy/paste. I don't know how to finish the coding off.

  1. #1
    Registered User
    Join Date
    09-14-2012
    Location
    Lancashire, England
    MS-Off Ver
    Excel 2016
    Posts
    31

    Error with multiple search/copy/paste. I don't know how to finish the coding off.

    Hello,

    I got some help in creating a script to sort out a database that I have. The database consists of over 100 rows with varying information and I needed to filter them via what is contained in a certain column (J).

    Please could you tell me how to end the below script?

    Thank You


    Please Login or Register  to view this content.
    Moderator's Edit: Use code tags when posting code. To do so in future, select your code and click on the # icon at the top of your post window.
    Last edited by Enigma1985; 11-28-2012 at 11:31 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Error with multiple search/copy/paste. I don't know how to finish the coding off.

    Are you looking for code which separates the data from one main sheet into other sheets based on a particular column?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    09-14-2012
    Location
    Lancashire, England
    MS-Off Ver
    Excel 2016
    Posts
    31

    Re: Error with multiple search/copy/paste. I don't know how to finish the coding off.

    Yes, for example: If the column J Contains the word "Blue" all this gets copied and pasted to the "Blue" sheet. There are approximately 23 different words in column J that will be filtered to roughly 12 sheets.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Error with multiple search/copy/paste. I don't know how to finish the coding off.

    Ok. Looks like its not as simple as 1:1 ratio that is 1 type of word goes to 1 sheet. For e.g. all Blue go to Blue, Red go to Red. So can you give me the conditions? Which are the 23 different words and what are the respective sheet names they go to?

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

    Re: Error with multiple search/copy/paste. I don't know how to finish the coding off.

    As long as you have a header in each sheet (with values in column A), and a sheet name for each color in column E, this should work.

    Please Login or Register  to view this content.
    Enjoy
    Last edited by stnkynts; 11-28-2012 at 06:24 PM.

  6. #6
    Registered User
    Join Date
    09-14-2012
    Location
    Lancashire, England
    MS-Off Ver
    Excel 2016
    Posts
    31

    Re: Error with multiple search/copy/paste. I don't know how to finish the coding off.

    Thanks for this but it isn't working. I have a sheet with lots of rows of data and what I need to do is filter this data by the information in column J. When I received the spreadsheet the previous person used autofilter and used to just copy and paste them on to their relevant sheet. (E.G. Select Blue, Turquoise and Dark Blue in the autofilter box, then copy the results and put them on to the sheet labelled 'Blue'. This would then be repeated for the all the other 'colours') I can't put their actual names on here I'm afraid but the colours would be substituted for the words I am using. The first part of the coding worked and I was told that I could just copy and pasted the code, one after another but just change the search words, but when I added anything extra, I got an error in VBA and I thought this was because I hadn't ended the code properly.

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

    Re: Error with multiple search/copy/paste. I don't know how to finish the coding off.

    What about it wasn't working?

    My code was a very compressed version of what I thought it was that you wanted to do. If we want to go back to the "If" statements that you are using it would be better to go with "Select Case". This was tested on a workbook and as long as the parameters that i defined in my previous post are met ("As long as you have a header in each sheet (with values in column A)") it hopefully should meet your needs (you will need to add stuff in for all the different colors. Just follow the scheme).

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    09-14-2012
    Location
    Lancashire, England
    MS-Off Ver
    Excel 2016
    Posts
    31

    Re: Error with multiple search/copy/paste. I don't know how to finish the coding off.

    AWESOME!!! Apologies, I obviously didn't understand the first code but this one is amazing! Thank you for this!

+ 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