+ Reply to Thread
Results 1 to 8 of 8

Write a macro that filters, copies and pastes data according to a drop-down list

  1. #1
    Registered User
    Join Date
    08-18-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    Write a macro that filters, copies and pastes data according to a drop-down list

    Hi.

    I have a large sheet of data in one worksheet, and have created a dropdown list (of client names) in another worksheet.

    I'd like to be able to select a client from the list, and have that automatically copy and paste the rows from the data which correspond to that client to an area below.

    Does anyone know how I can do this?

    I managed to find an example online which looked like what I want, but when I tried running it for my sheet it said "compile error: sub or function not defined"
    I checked the references, and they were all the same as for the example script, so not sure why it didn't work.

    ---------- Post added at 07:36 PM ---------- Previous post was at 07:35 PM ----------

    Oops, sent early.

    If anyone could help with either issue I would be very grateful!!

    Thank you

  2. #2
    Registered User
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Write a macro that filters, copies and pastes data according to a drop-down list

    Hi,

    Welcome to the forum.

    I can write a macro for you on this. Before that, jst want to clarify the below things.

    For example,
    your data sheet name is - "Raw Data" and client names are in "A" Column
    Your client name list sheet name is - "List"

    I will give an option that you can select the client name from the list and click on a button or a shortcut key and your client data gets extracted from the raw data sheet to output sheet (New Sheet).

    Let me know if it tunes fine for you, so that I can draft a macro accordingly.

    Rgds,
    KK

  3. #3
    Registered User
    Join Date
    08-18-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Write a macro that filters, copies and pastes data according to a drop-down list

    Hi, thank you very much for your response.

    The client column is column Q, not C, otherwise that looks fine.

    If the data could be copied to the same sheet with the dropdown list, that would be ideal, but if not, a new sheet is better than nothing!

    Thanks

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Write a macro that filters, copies and pastes data according to a drop-down list

    hi ClaraW89, any chance to have a sample workbook showing original data and result you'd like to obtain?

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Write a macro that filters, copies and pastes data according to a drop-down list

    to make a start, please check attachment. Select customer name on Sheet "Report" in B2. If nothing happens, please run macro "EnableEvent" and try again
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    08-18-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Write a macro that filters, copies and pastes data according to a drop-down list

    Thanks, this is a good start. At the moment though, it's only returning the first row of the raw data (equivalent to your F1 - F19 row)
    All I changed from yours to mine was the cell references (for the reference cell and where to copy the data to)

    Any ideas what could be going wrong?

    Thanks again,
    Clara

  7. #7
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Write a macro that filters, copies and pastes data according to a drop-down list

    can you post the file with amended code?

  8. #8
    Registered User
    Join Date
    08-18-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Write a macro that filters, copies and pastes data according to a drop-down list

    Sure, I tried posting it yesterday, but it was too big (a lot of data!) so I'll just make a smaller version now then attach it

    ---------- Post added at 01:43 PM ---------- Previous post was at 01:34 PM ----------

    I'm confused - trying to attach the file, but it keeps giving me an error?

    Also, I tried running the macro the long way (clicking tools, macros, run etc) and I got the error "run-time error '1004': Unable to set the ScrollRow property of the Window class"
    Do you know what this means and could it be the problem?

    Thanks

+ 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