VBA - Pull cell if another cell contains and create a summary

  • Hi I saw this post, http://www.ozgrid.com/forum/showthread.php?t=190548 and I am using some of the same code however, I need a little help in customizing it. I am using the code to pull the data into a summary page and that works but I am trying to break it into titles. Thanks for your help in advance. I am still really new to vba.



    I have 2 sheets within a work book. The first sheet we will call assessment. In this sheet it has multiple rows of questions (approx. 422 rows of questions). The questions are in the "C" column. On the same row in columns AD (yes) and AG (no) is where the assessor will mark the box with an X as the result. The questions are broken into 7 groups with Titles( example would be Prepare Resources and Mobilize Resources). See below. On the second sheet I call it summary. Which I want to pull the title of the section and the questions from that section in column "B" IF the cell AG (no) contains an X. I want to be able to create a summary page to hand to the manager that contains the title of the section and what questions were marked as no in that section.


    [TABLE="class: cms_table_cms_table_grid, width: 500"]

    [tr]


    [td]

    Row 12

    [/td]


    [td]

    Col. C

    [/td]


    [td]

    Col. AD (Yes)

    [/td]


    [td]

    Col. AG (No)

    [/td]


    [/tr]


    [tr]


    [td]

    15

    [/td]


    [td]

    Prepare Resources

    [/td]


    [td][/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    16

    [/td]


    [td]

    Question asked 1

    [/td]


    [td][/td]


    [td]

    X

    [/td]


    [/tr]


    [tr]


    [td]

    17

    [/td]


    [td]

    Question asked 2

    [/td]


    [td]

    X

    [/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    18

    [/td]


    [td]

    Question asked 3

    [/td]


    [td][/td]


    [td]

    X

    [/td]


    [/tr]


    [tr]


    [td]

    25

    [/td]


    [td]

    Mobilize Resources

    [/td]


    [td][/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    26

    [/td]


    [td]

    Question asked 4

    [/td]


    [td][/td]


    [td]

    X

    [/td]


    [/tr]


    [tr]


    [td]

    27

    [/td]


    [td]

    Question asked 5

    [/td]


    [td]

    X

    [/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    28

    [/td]


    [td]

    Question asked 6

    [/td]


    [td][/td]


    [td]

    X

    [/td]


    [/tr]


    [/TABLE]




    The summary page I would like to look like this with only if questions were marked with a x in the AG(no) column.


    [TABLE="class: cms_table_cms_table_grid, width: 500"]

    [tr]


    [td]

    Prepare Resources

    [/td]


    [/tr]


    [tr]


    [td]

    Question asked 1

    [/td]


    [/tr]


    [tr]


    [td]

    Question asked 3

    [/td]


    [/tr]


    [tr]


    [td]

    Mobilize Resources

    [/td]


    [/tr]


    [tr]


    [td]

    Question asked 4

    [/td]


    [/tr]


    [tr]


    [td]

    Question asked 6

    [/td]


    [/tr]


    [/TABLE]


    I am getting closer. I am able to pull the data into the sheet. I am still struggling on how to separate it. I am curious can I set up multiple subs (one for prepare resources, one for mobilize)and create a range with in it to separate into different titles?


  • Re: VBA - Pull cell if another cell contains and create a summary


    It would probably help if you uploaded a sample workbook. That way we don't have to try and recreate your workbook and we have something to test the code with.


    When you click reply there will be a new button labeled go advanced, click on that button then there will be a paperclip icon in the toolbar, click on that icon and follow the instructions.

    Bruce :cool:

  • Re: VBA - Pull cell if another cell contains and create a summary


    Quote from skywriter;768753

    It would probably help if you uploaded a sample workbook. That way we don't have to try and recreate your workbook and we have something to test the code with.


    When you click reply there will be a new button labeled go advanced, click on that button then there will be a paperclip icon in the toolbar, click on that icon and follow the instructions.


    I have created a dummy book with the 2 sheets and macro in it with 2 Titles (bolded grey background), some sample data and check boxes setup just like my original sheet minus the 400ish lines of data and 7 Titles. I am hoping this will be ok.

  • Re: VBA - Pull cell if another cell contains and create a summary


    This works with your sample workbook.


    Bruce :cool:

  • Re: VBA - Pull cell if another cell contains and create a summary


    Thank you! That works. One last thing, is it possible to pull the main heading as well, so on the sample book it would be Prepare Resources, and Mobilize Resources.

  • Re: VBA - Pull cell if another cell contains and create a summary


    That is more complicated with the way your worksheet is formatted, maybe someone else has an easy solution, I don't.


    A new thread might be your best bet.

    Bruce :cool:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!