Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Spreadsheets (https://www.askmehelpdesk.com/forumdisplay.php?f=395)
-   -   Looking for VBA to sort workers (https://www.askmehelpdesk.com/showthread.php?t=768064)

  • Sep 21, 2013, 02:41 AM
    dannac
    Looking for VBA to sort workers
    http://i819.photobucket.com/albums/z...ps473c86c9.jpg

    Workbook has 2 sheets.
    Sheet 1 has all the data.
    Workers in col A and the amount of rows changes.
    Categories are listed in B1:X1.

    Sheet 2 has a validation dropdown in cell A1.
    It references a named range from sheet 1 (B1:X1)

    Workers have info under different categories.

    From sheet 2 I would like to choose a name from the dropdown in A1.
    The macro would search categories on Sheet 1 that match dropdown.

    Then copy the worker's entire row... only if they have info under that category.

    Row would be copied to sheet 2 starting in cell A3.
  • Sep 21, 2013, 07:21 AM
    ScottGem
    Excel has a macro recorder. You can try recording the steps you take, then view the generated code to make it more dynamic.
  • Sep 21, 2013, 09:25 AM
    dannac
    I have used macro recorder for simple things.

    I do not believe this can even be started, much less accomplished with the macro recorder.

    Not a simple task.

    Thanks for your reply.
  • Sep 21, 2013, 10:07 AM
    ScottGem
    You should be able to record a macro to copy a range from one area to another. Then look at the selection process.

    At least it will be a start.
  • Sep 24, 2013, 12:32 PM
    dannac
    Yes I can record a copy operation with a macro.

    I do not see how to record a "find" or "search" operation with a macro.

    I'm hoping the "Software Expert" can help.
  • Sep 26, 2013, 01:37 AM
    JBeaucaire
    Your question first states sheet2 A1 would have a drop down comprised of B1:X1 from SHeet1, that's the categories.

    Then you state you'd like to choose a worker name in A1. You would need a second cell, perhaps B1 to select the worker name?

    Else your requirements are unclear. Please restate them step by step.

    Sheet1
    1) Names in column A
    2) Categories in Row 1

    Sheet2
    3) A1 has a drop down with categories from sheet1
    4) B1 has a drop down with names from sheet1

    Event
    5) When a category is A1 AND a name in B1 are selected, the following happens:

    - - ?
    - - ?
    - - ?

    Please be very specific. Thanks.
  • Sep 26, 2013, 04:15 AM
    dannac
    Morning JB... you up early.

    I do not believe I stated I would choose a worker name.

    In fact, I should not have mentioned anything about the worker names as it does not look for worker name.

    It would search category only.

    It finds the category and copies the entire row of "non-blank" cells under that category to Sheet 2 starting at A3.

    Thanks for replying
  • Sep 26, 2013, 06:48 AM
    dannac
    http://i819.photobucket.com/albums/z...ps473c86c9.jpg

    If I would search for Cat3 from the dropdown on Sheet 2

    It would return row 3, 6, and 8 to Sheet 2 starting at A3.
  • Sep 26, 2013, 11:39 PM
    JBeaucaire
    1 Attachment(s)
    Like so, see attached.
  • Sep 27, 2013, 02:07 AM
    dannac
    Exactly... thanks very much JB.

  • All times are GMT -7. The time now is 05:08 PM.