Sort alphabetically with Gender also

shimaa01234

Active Member
Joined
Jun 24, 2014
Messages
446
I want code to arrange the names alphabetically and by type also
With the possibility to choose male or female first
NAMETYPE
AMale
BFemale
CFemale
DMale
EMale
FMale
GMale
HFemale
IFemale
JMale
KFemale
LFemale
MMale
NFemale
OMale

<colgroup><col span="2"></colgroup><tbody>
</tbody>
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
I want to filter born in the month of October

Birthday
30-Jul-1967
25-May-1963
8-Mar-1982
12-Oct-1975
28-Jan-1966
24-Dec-1955
3-May-1982
14-Dec-1981
4-Feb-1986
13-Jan-1986
29-Jan-1985
12-Jun-1984
7-Feb-1984
13-Jan-1987
5-Dec-1982
17-Apr-1983
31-Mar-1987

<colgroup><col></colgroup><tbody>
</tbody>
 
Upvote 0
Is this new data part of the original (previous) sort Data or something separate ?????
 
Upvote 0
Try this:-
Select List.
From Data Tab, Select Filter
Select Filter drop down
Select "Date Filters"
Select "All Dates in the period"
Select "October"
 
Upvote 0
Your data assumed to be in column "A".

Right click sheet Tab, Select "View Code". VB window appears.
Paste code into VB window.
Close VB Window

To run code Select Date with required Month from Date list :- Rows Hidden
Select Cell "A1":- Rows Unhidden
Code:
Private [COLOR="Navy"]Sub[/COLOR] Worksheet_SelectionChange(ByVal Target [COLOR="Navy"]As[/COLOR] Range)
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] nRng [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]If[/COLOR] Target.Address(0, 0) = "A1" [COLOR="Navy"]Then[/COLOR]
Rows.Hidden = False
[COLOR="Navy"]ElseIf[/COLOR] Target.Column = 1 And Target.Count = 1 [COLOR="Navy"]Then[/COLOR]
 [COLOR="Navy"]Set[/COLOR] Rng = Range(Range("A2"), Range("A" & Rows.Count).End(xlUp))
    [COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    [COLOR="Navy"]If[/COLOR] Not Month(Dn.Value) = Month(Target) [COLOR="Navy"]Then[/COLOR]
        [COLOR="Navy"]If[/COLOR] nRng [COLOR="Navy"]Is[/COLOR] Nothing [COLOR="Navy"]Then[/COLOR]
            [COLOR="Navy"]Set[/COLOR] nRng = Dn
        [COLOR="Navy"]Else[/COLOR]
            [COLOR="Navy"]Set[/COLOR] nRng = Union(nRng, Dn)
        [COLOR="Navy"]End[/COLOR] If
    [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]If[/COLOR] Not nRng [COLOR="Navy"]Is[/COLOR] Nothing [COLOR="Navy"]Then[/COLOR] nRng.EntireRow.Hidden = True
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,215,945
Messages
6,127,851
Members
449,411
Latest member
adunn_23

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