Copy range based on criteria in column - macro

doriannjeshi

Active Member
Joined
Apr 5, 2015
Messages
301
Office Version
  1. 365
Platform
  1. Windows
Hi,
how to copy the entire data only for "male" to a new sheet named "male" , also for female. Using a macro


Book2
ABCDEF
1idfirst_namelast_nameemailgenderip_address
21RikkiPererpere0@alexa.comMale61.164.210.42
32VickAmbrozikvambrozik1@google.itMale102.222.176.131
43KaliSheltonkshelton2@slate.comBigender209.89.60.163
54LodovicoShearslshears3@bandcamp.comMale175.100.178.34
65RhodaGavaranrgavaran4@alexa.comFemale131.26.160.86
76GerriNealegneale5@independent.co.ukMale76.95.229.131
87TodEmmitttemmitt6@dot.govMale249.234.72.77
98KillyLouysklouys7@networksolutions.comMale226.205.57.155
109JohnnaManlowjmanlow8@freewebs.comFemale66.160.3.172
1110ShandeighPossellspossell9@blogspot.comFemale54.79.95.159
1211ThelmaCorballistcorballisa@mediafire.comFemale209.246.69.109
1312ChristabellaMcCowancmccowanb@skyrock.comFemale254.29.4.81
1413TristanStedetstedec@weibo.comMale58.238.118.14
1514KlaraStorreskstorresd@parallels.comFemale103.61.128.129
1615BendixCavnorbcavnore@addthis.comPolygender115.197.228.198
1716PammiWhilespwhilesf@archive.orgFemale235.85.253.158
1817SenaFothergillsfothergillg@indiatimes.comFemale121.116.167.159
1918OfeliaSargisonosargisonh@uiuc.eduFemale30.29.132.119
2019OberonEndoendi@dedecms.comMale19.176.34.160
2120CaresaKybbyeckybbyej@a8.netAgender157.221.2.249
2221SaundraYeldingsyeldingk@reddit.comMale240.178.148.42
2322DaisyParnelldparnelll@home.plFemale5.136.226.91
2423PrueCorranpcorranm@istockphoto.comFemale16.235.134.99
2524GamalielMoyseygmoyseyn@t-online.deMale56.38.94.245
2625PebrookQuinionpquiniono@naver.comMale88.85.159.192
2726DouglassRossidrossip@yahoo.co.jpMale20.52.3.13
2827KayneMertonkmertonq@fotki.comMale228.35.108.191
2928OonaBiddlestoneobiddlestoner@trellian.comFemale25.80.120.56
3029TheadoraBlacktintblacktins@jimdo.comFemale7.174.1.190
3130PheliaRykertprykertt@ning.comFemale128.142.83.253
Sheet1


result

Book2
ABCDEF
1idfirst_namelast_nameemailgenderip_address
21RikkiPererpere0@alexa.comMale61.164.210.42
32VickAmbrozikvambrozik1@google.itMale102.222.176.131
44LodovicoShearslshears3@bandcamp.comMale175.100.178.34
56GerriNealegneale5@independent.co.ukMale76.95.229.131
67TodEmmitttemmitt6@dot.govMale249.234.72.77
78KillyLouysklouys7@networksolutions.comMale226.205.57.155
813TristanStedetstedec@weibo.comMale58.238.118.14
919OberonEndoendi@dedecms.comMale19.176.34.160
1021SaundraYeldingsyeldingk@reddit.comMale240.178.148.42
1124GamalielMoyseygmoyseyn@t-online.deMale56.38.94.245
1225PebrookQuinionpquiniono@naver.comMale88.85.159.192
1326DouglassRossidrossip@yahoo.co.jpMale20.52.3.13
1427KayneMertonkmertonq@fotki.comMale228.35.108.191
male
 
This has not been mentioned before. Just as Married was not mentioned at the start.
You need to specify your requirements (all of them) at the beginning rather than getting an answer and then changing the requirement continually. :(
You are right, I apologise I added a request after the original post

about the second request I was sure I could modify the macro to include more than 2 criteria in one sheet, my bad
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
OK, lets start afresh. With XL2BB can you give some new (small) sample data, explain all of exactly what you want & also provide the expected results?
 
Upvote 0
Yes, at this point I just need to have the macro that puts all the months that I can specify to a NEW sheet named "months"

Book2
ABCDEF
1ABCDEF
2june3-31
3june31111
4april3111
5may31111
6february311
7october311
8october311
9november311
10december311
11
12
13result
14ABCDEF
15june3-31
16june31111
17may31111
18october311
19october311
20sheet name"months"
sheet12
 
Upvote 0
Yes, this scenario needs own thread as everything else was solved in this thread

thank you Peter and Mark
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,892
Messages
6,175,236
Members
452,621
Latest member
Laura_PinksBTHFT

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
Back
Top