+ Reply to Thread
Results 1 to 7 of 7

Copy Paste cells into a new sheet based on criteria macro

  1. #1
    Registered User
    Join Date
    06-18-2012
    Location
    Columbus
    MS-Off Ver
    Excel 2007
    Posts
    4

    Copy Paste cells into a new sheet based on criteria macro

    Hi,

    I'm using excel to format the results I get from Survey Monkey. In Survey Monkey I ask the person to identify who they are and then they are asked questions which are relevant to them. Each person has different questions and a different number of questions. The file I download from Survey Monkey has a column with the survey peoples names in it (say column A) under the heading 'Please identify the part of the business you represent.' and then has the questions in row 1, one persons after another. Then, each persons response is recorded in the row which correlates to their name and comes under their question heading. I've attached an example of how this looks in excel in this thread.

    What I need to do is have a macro which takes the persons name (what comes under the heading 'Please identify the part of the business you represent.'), puts it into a new worksheet, and then takes the questions which relate to them and put the question and their response one under the other. So each persons responses will be on a new worksheet. What this should look like is on sheet2 of the attached file. I need a macro to do this as I'll be having a new survey to process every month. Also, there is the possibility that I will need to add questions or take some out, so if the macro can search for the responses and number of questions for each person, then it will work.

    Thanks.
    Attached Files Attached Files

  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: Copy Paste cells into a new sheet based on criteria macro

    there is the possibility that I will need to add questions or take some out, so if the macro can search for the responses and number of questions for each person, then it will work.
    What do you mean by this?

    If you have to run the same macro again during the month with new data, do you want the data in all the sheets to be cleared and fresh data input? Or should the data be appended to the end of each sheet?
    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
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Copy Paste cells into a new sheet based on criteria macro

    Give this a whirl,

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  4. #4
    Registered User
    Join Date
    06-18-2012
    Location
    Columbus
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Copy Paste cells into a new sheet based on criteria macro

    Arlu1201,

    Every month there is a survey but the questions could change from month to month. So I will only run the macro once for each month with whatever questions I've asked that time. Then, the next month I'll do the survey and run the macro on the results. However, I might have had to change a question or two.

    JapanDave,

    Thanks for the code, it works really well until I put a paragraph of writing into the 'Rational' column. That column on the survey is for the person to give a bit of an explination as to why they've answered the previous questions they way the have. When I run the macro it stops at this line -

    wsOut.Cells(1, 1).Resize(x - 1, 2).Value = Application.WorksheetFunction.Transpose(cl)

    I'm not sure why, is it to do with the length of text, or punctuation, symbles or something?

  5. #5
    Registered User
    Join Date
    06-18-2012
    Location
    Columbus
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Copy Paste cells into a new sheet based on criteria macro

    Can you make it so that it wraps the text of the 'Rational' column? Would that fix it?

  6. #6
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Copy Paste cells into a new sheet based on criteria macro

    Try this and see if it is what you need.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-18-2012
    Location
    Columbus
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Copy Paste cells into a new sheet based on criteria macro

    Thank you for your replies JapanDave. Unfortunetly it still gets stuck at that same line. I've attached your macro file below and I've put a very long response into the rational column. If you run the macro you will see that it stops at the line.Excel Problem.xlsm

+ 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