Copy cells based on conditions

Solved/Closed
pefler Posts 2 Registration date Monday October 5, 2015 Status Member Last seen January 26, 2016 - Oct 5, 2015 at 10:59 AM
pefler Posts 2 Registration date Monday October 5, 2015 Status Member Last seen January 26, 2016 - Oct 8, 2015 at 03:27 AM
Hello,

I want to make several versions of a questionnaire specific for each out of 11 types of a product. Therefore I made a button for each of the product categories on Sheet1 and all possible questions in a column of another sheet (Sheet2; range A2-A211). Here the first row would be the names of the mentioned categories (B1-L1) and under each category would be either "1", "2" or nothing. What I want to do is, that when one of the category is chosen (one clicks on one of the buttons on Sheet1), it copy-pastes the questions (Sheet2; A2-A211) based on the code under the particular category. For example I click on the button no.3 on Sheet1 and the macro will copy-paste the only questions from Sheet2, where there is "1" or "2" in the particular column (in this case D2-D211) with the difference that it is going to mark the ones where there is "2" by red colour as required (or something like that). Where there is no number in that particular column, the question is not going to be copy-pasted. They should also obviously come under each other without gaps. I am a total rookie in this, but it does not sound like a difficult thing. Can anyone help me, please? Thanks a lot!

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Oct 6, 2015 at 12:11 PM
You can get started by using macro recorder

Basic idea would be to on click of the button, you filter the other sheet for the appropriate values. copy all the filtered data and paste on your new sheet
1
pefler Posts 2 Registration date Monday October 5, 2015 Status Member Last seen January 26, 2016
Oct 8, 2015 at 03:27 AM
Thanks a lot! I've been playing with it now for a little while and it's very useful. Though I may still come back with some questions.
0