+ Reply to Thread
Results 1 to 3 of 3

Macro to Search, Copy/Paste onto New Sheet

  1. #1
    Registered User
    Join Date
    02-13-2008
    Posts
    4

    Macro to Search, Copy/Paste onto New Sheet

    Hello,

    I have a data file that ID #'s and their associated reponses to various questions asked. In addition to their coded responses to multiple choice questions, they are also given the option to provide additional comments, however that is not required. Therefore some people write comments, and otehrs do not. I am trying to write a macro that would locate those respondents who wrote a comment (in column M) and then paste their comment and the related project # (in column B) and paste that onto the sheet for which the comments are for (identified in column F).

    I'm not sure if this is even something that can be done, or if this is too complex, so any feedback and assistance would be greatly appreciated! Thanks so much in anvance! Below are some of the specifics that I tried to write out.


    Select Sheet Raw Data

    Search for the first active cell in column M

    Within that row containing the active cell in column M:
    Copy and Paste the following cells onto a new sheet in the first blank row on Sheet based on value in column F (detailed below)


    If value in column F equals "Design Services" then copied selections (listed below) are copied into sheet name "Design Services"

    If value in column F equals "Panel" then copied selections (listed below) are copied into sheet name "Panel"

    If value in column F equals "Telephone" then copied selections (listed below) are copied into sheet name "Telephone"

    If value in column F equals "Interactive" then copied selections (listed below) are copied into sheet name "Interactive"

    If value in column F equals "Mail" then copied selections (listed below) are copied into sheet name "Mail"

    If value in column F equals "MCP" then copied selections (listed below) are copied into sheet name "MCP"

    If value in column F equals "Field Services" then copied selections (listed below) are copied into sheet name "Field Services"

    If value in column F equals "CATI" then copied selections (listed below) are copied into sheet name "CATI"

    If value in column F equals "Coding" then copied selections (listed below) are copied into sheet name "Coding"

    If value in column F equals "DP" then copied selections (listed below) are copied into sheet name "DP"

    If value in column F equals "AA&D" then copied selections (listed below) are copied into sheet name "AA&D"

    If value in column F equals "Research Excellence" then copied selections (listed below) are copied into sheet name "Research Excellence"

    -Value in column B (from sheet Raw Data) gets pasted into column A on the first blank row (paste into sheet specified above)
    -Value in column F (from sheet Raw Data) gets pasted into column C on the first blank row (paste into sheet specified above)
    -Value in column M (from sheet Raw Data) gets pasted into column B on the first blank row (paste into sheet specified above)

    I would then like the macro to continue cycling through column M until it gets to the last active cell.
    Last edited by VBA Noob; 02-13-2008 at 02:32 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Quote Originally Posted by JADownie
    Hello,

    I have a data file that ID #'s and their associated reponses to various questions asked. In addition to their coded responses to multiple choice questions, they are also given the option to provide additional comments, however that is not required. Therefore some people write comments, and otehrs do not. I am trying to write a macro that would locate those respondents who wrote a comment (in column M) and then paste their comment and the related project # (in column B) and paste that onto the sheet for which the comments are for (identified in column F).

    I'm not sure if this is even something that can be done, or if this is too complex, so any feedback and assistance would be greatly appreciated! Thanks so much in anvance! Below are some of the specifics that I tried to write out.


    Select Sheet Raw Data

    Search for the first active cell in column M

    Within that row containing the active cell in column M:
    Copy and Paste the following cells onto a new sheet in the first blank row on Sheet based on value in column F (detailed below)


    If value in column F equals "Design Services" then copied selections (listed below) are copied into sheet name "Design Services"

    ...snipped
    Hi,

    Try the following VBA macro. It assumes your data sheet is named "Data"

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    JADownie,

    Please read forum rules and message to cross posters below

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

+ 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