Help Copy Rows based on Cells Values Problem

purceld2

Well-known Member
Joined
Aug 18, 2005
Messages
581
Office Version
  1. 2013
Platform
  1. Windows
Hi There

I have a problem where I need rows to a new sheet based on multiple cell values in the row. I have 5 dropdown list box where the user selects values (with the possibility that the user can select multiple values in the dropdown list box) these values are picked up by the VBA to determine which row in the data sheet to copy. The bit that is perplexing me is that in the audience dropdown list the user can select yes, which means that any row, which has a yes in the sub audience needs to be copied.

Can anybody give me a head start with the code or suggest a better solution.

Dropdown list box examples

Excel 2010
AB
1Format
2
3
4
5
6Client (Max of 5)
7
8
9
10Brand (Max 5)
11
12
13
14Published
15
16
17
18Audience
19
20
21
22

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
V1




Data

Excel 2010t<d style="border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">Yes</d>t<d style="border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">No</d>t<d style="border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">No</d>
ABCDEFGHIJKLMNOPQR
1Audience< style="font-weight: bold;text-align: center;border-bottom: 1px solid black;background-color: #FFFF00;;">
2FormatClientBrandPublishedYouthMum's on the RunTradesmanFemale CommuterMale CommuterSME'sABC1C2DEHouswives with KidsMenWomen15-2435-6465+
3Case StudyMaster FoodsMars 2009NoNoNoNoNoNoNoNoNoNoNo
4Face to Face ResearchDiageoGuiness2008YesYesYesYesYesYesYesYesYesYes
5Category Insight2007NoNoNoNoNoNoNoNoNoNo
6EPOS Data2010NoNoNoNoNoNoNoNoNoNo
7Pitch
8

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet3
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Rijnsent

Well-known Member
Joined
Oct 17, 2005
Messages
1,338
Office Version
  1. 365
Platform
  1. Windows
Hey Purceld2,

if it doesn't matter for you in which column of the audience block the "yes" is located, I would probably use a helper column. An extra column with a formula to determine if there is a "Yes" in any of the Audience cells. An alternative is to make that helper column but basically make one long string of your "audience" data. So that could be "NoNoNoNoNoYesYesYes". Next, if the user fills in "Yes" to filter upon, you could filter on "*"&users choice & "*".

Hope those pointers help,

Koen
 

purceld2

Well-known Member
Joined
Aug 18, 2005
Messages
581
Office Version
  1. 2013
Platform
  1. Windows
Thanks Rijnsent,

Your advice is very much appreciated.

Just one thing that I am not clear is how could I filter on "*"&users choice & "*", could you elaburate please.

Kind Regards
Desmond
 

Rijnsent

Well-known Member
Joined
Oct 17, 2005
Messages
1,338
Office Version
  1. 365
Platform
  1. Windows
Hey Desmond,

okay, say you add that column with all the columns "together". E.g. with a formula like =E3&F3&G3&H3&I3&J3 etc. That would mean "NoNoNoNoNoNo". If you filter that column with a text filter that "Contains" "Yes", it does filter all the rows where there is "Yes" in any of your columns.
So basically the *-s mean the "contains" filter: if you filter on "*Yes*" all strings that contains a Yes will be filtered.

Hope that helps,

Koen
 

purceld2

Well-known Member
Joined
Aug 18, 2005
Messages
581
Office Version
  1. 2013
Platform
  1. Windows
Hey Desmond,

okay, say you add that column with all the columns "together". E.g. with a formula like =E3&F3&G3&H3&I3&J3 etc. That would mean "NoNoNoNoNoNo". If you filter that column with a text filter that "Contains" "Yes", it does filter all the rows where there is "Yes" in any of your columns.
So basically the *-s mean the "contains" filter: if you filter on "*Yes*" all strings that contains a Yes will be filtered.

Hope that helps,

Koen

Thank you
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,015
Messages
5,834,939
Members
430,327
Latest member
Mr_Himalayan778

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top