Multiple Sort In Same Column

RandyD123

Active Member
Joined
Dec 4, 2013
Messages
296
Office Version
  1. 2016
Platform
  1. Windows
I am looking to sort using a VBA code that will sort my attached sheet by Airline then by Time. The only catch is that the Airlines must be held together, meaning all DL first by time, then all SW second by time......and so on. Each individual day must sort using the code. Obviously this is only part of the sheet that I attached but I assume if this is even possible I can just continue the code to get all 42 individual calendar blocks.

If possible with on space between each one.

Thank you to anyone that can help.

[TABLE="width: 1650"]
<tbody>[TR]
[TD="colspan: 4"]Tuesday, March 1, 2016[/TD]
[TD][/TD]
[TD="colspan: 4"]Wednesday, March 2, 2016[/TD]
[TD][/TD]
[TD="colspan: 4"]Thursday, March 3, 2016[/TD]
[TD][/TD]
[TD="colspan: 4"]Friday, March 4, 2016[/TD]
[TD][/TD]
[TD="colspan: 4"]Saturday, March 5, 2016[/TD]
[TD][/TD]
[TD="colspan: 4"]Sunday, March 6, 2016[/TD]
[/TR]
[TR]
[TD]Airline[/TD]
[TD]Dest[/TD]
[TD]Time[/TD]
[TD]Cap.[/TD]
[TD][/TD]
[TD]Airline[/TD]
[TD]Dest[/TD]
[TD]Time[/TD]
[TD]Cap.[/TD]
[TD][/TD]
[TD]Airline[/TD]
[TD]Dest[/TD]
[TD]Time[/TD]
[TD]Cap.[/TD]
[TD][/TD]
[TD]Airline[/TD]
[TD]Dest[/TD]
[TD]Time[/TD]
[TD]Cap.[/TD]
[TD][/TD]
[TD]Airline[/TD]
[TD]Dest[/TD]
[TD]Time[/TD]
[TD]Cap.[/TD]
[TD][/TD]
[TD]Airline[/TD]
[TD]Dest[/TD]
[TD]Time[/TD]
[TD]Cap.[/TD]
[/TR]
[TR]
[TD]US4577[/TD]
[TD]DCA[/TD]
[TD]1800[/TD]
[TD]75[/TD]
[TD][/TD]
[TD]US4577[/TD]
[TD]DCA[/TD]
[TD]1800[/TD]
[TD]75[/TD]
[TD][/TD]
[TD]US4577[/TD]
[TD]DCA[/TD]
[TD]1800[/TD]
[TD]75[/TD]
[TD][/TD]
[TD]US4577[/TD]
[TD]DCA[/TD]
[TD]1800[/TD]
[TD]75[/TD]
[TD][/TD]
[TD]US4577[/TD]
[TD]DCA[/TD]
[TD]1800[/TD]
[TD]75[/TD]
[TD][/TD]
[TD]US4577[/TD]
[TD]DCA[/TD]
[TD]1800[/TD]
[TD]75[/TD]
[/TR]
[TR]
[TD]US4472[/TD]
[TD]PHL[/TD]
[TD]1500[/TD]
[TD]50[/TD]
[TD]US4472[/TD]
[TD]PHL[/TD]
[TD]1500[/TD]
[TD]50[/TD]
[TD]US4472[/TD]
[TD]PHL[/TD]
[TD]1500[/TD]
[TD]50[/TD]
[TD]US4472[/TD]
[TD]PHL[/TD]
[TD]1500[/TD]
[TD]50[/TD]
[TD]US4472[/TD]
[TD]PHL[/TD]
[TD]1500[/TD]
[TD]50[/TD]
[TD]US4472[/TD]
[TD]PHL[/TD]
[TD]1500[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]US4465[/TD]
[TD]CLT[/TD]
[TD]1200[/TD]
[TD]80[/TD]
[TD]US4465[/TD]
[TD]CLT[/TD]
[TD]1200[/TD]
[TD]80[/TD]
[TD]US4465[/TD]
[TD]CLT[/TD]
[TD]1200[/TD]
[TD]80[/TD]
[TD]US4465[/TD]
[TD]CLT[/TD]
[TD]1200[/TD]
[TD]80[/TD]
[TD]US4465[/TD]
[TD]CLT[/TD]
[TD]1200[/TD]
[TD]80[/TD]
[TD]US4465[/TD]
[TD]CLT[/TD]
[TD]1200[/TD]
[TD]80[/TD]
[/TR]
[TR]
[TD]US3827[/TD]
[TD]PHL[/TD]
[TD]1400[/TD]
[TD]75[/TD]
[TD]US3827[/TD]
[TD]PHL[/TD]
[TD]1400[/TD]
[TD]75[/TD]
[TD]US3827[/TD]
[TD]PHL[/TD]
[TD]1400[/TD]
[TD]75[/TD]
[TD]US3827[/TD]
[TD]PHL[/TD]
[TD]1400[/TD]
[TD]75[/TD]
[TD]US3827[/TD]
[TD]PHL[/TD]
[TD]1400[/TD]
[TD]75[/TD]
[TD]US3827[/TD]
[TD]PHL[/TD]
[TD]1400[/TD]
[TD]75[/TD]
[/TR]
[TR]
[TD]US4082[/TD]
[TD]PHL[/TD]
[TD]800[/TD]
[TD]100[/TD]
[TD]US4082[/TD]
[TD]PHL[/TD]
[TD]800[/TD]
[TD]100[/TD]
[TD]US4082[/TD]
[TD]PHL[/TD]
[TD]800[/TD]
[TD]100[/TD]
[TD]US4082[/TD]
[TD]PHL[/TD]
[TD]800[/TD]
[TD]100[/TD]
[TD]US4082[/TD]
[TD]PHL[/TD]
[TD]800[/TD]
[TD]100[/TD]
[TD]US4082[/TD]
[TD]PHL[/TD]
[TD]800[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]US3775[/TD]
[TD]DCA[/TD]
[TD]700[/TD]
[TD]45[/TD]
[TD]US3775[/TD]
[TD]DCA[/TD]
[TD]700[/TD]
[TD]45[/TD]
[TD]US3775[/TD]
[TD]DCA[/TD]
[TD]700[/TD]
[TD]45[/TD]
[TD]US3775[/TD]
[TD]DCA[/TD]
[TD]700[/TD]
[TD]45[/TD]
[TD]US3775[/TD]
[TD]DCA[/TD]
[TD]700[/TD]
[TD]45[/TD]
[TD]US3775[/TD]
[TD]DCA[/TD]
[TD]700[/TD]
[TD]45[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]SW1270[/TD]
[TD]MDW[/TD]
[TD]530[/TD]
[TD]175[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]SW647[/TD]
[TD]BWI[/TD]
[TD]555[/TD]
[TD]143[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]SW1537[/TD]
[TD]MCO[/TD]
[TD]605[/TD]
[TD]143[/TD]
[TD]SW1270[/TD]
[TD]MDW[/TD]
[TD]530[/TD]
[TD]175[/TD]
[TD]SW1270[/TD]
[TD]MDW[/TD]
[TD]530[/TD]
[TD]175[/TD]
[TD]SW1270[/TD]
[TD]MDW[/TD]
[TD]530[/TD]
[TD]175[/TD]
[TD]SW1270[/TD]
[TD]MDW[/TD]
[TD]530[/TD]
[TD]175[/TD]
[TD]SW1270[/TD]
[TD]MDW[/TD]
[TD]530[/TD]
[TD]175[/TD]
[/TR]
[TR]
[TD]SW452[/TD]
[TD]BWI[/TD]
[TD]700[/TD]
[TD]137[/TD]
[TD]SW647[/TD]
[TD]BWI[/TD]
[TD]555[/TD]
[TD]143[/TD]
[TD]SW647[/TD]
[TD]BWI[/TD]
[TD]555[/TD]
[TD]143[/TD]
[TD]SW647[/TD]
[TD]BWI[/TD]
[TD]555[/TD]
[TD]143[/TD]
[TD]SW647[/TD]
[TD]BWI[/TD]
[TD]555[/TD]
[TD]143[/TD]
[TD]SW647[/TD]
[TD]BWI[/TD]
[TD]555[/TD]
[TD]143[/TD]
[/TR]
[TR]
[TD]SW1092[/TD]
[TD]BWI[/TD]
[TD]400[/TD]
[TD]175[/TD]
[TD]SW1537[/TD]
[TD]MCO[/TD]
[TD]605[/TD]
[TD]143[/TD]
[TD]SW1537[/TD]
[TD]MCO[/TD]
[TD]605[/TD]
[TD]143[/TD]
[TD]SW1537[/TD]
[TD]MCO[/TD]
[TD]605[/TD]
[TD]143[/TD]
[TD]SW1537[/TD]
[TD]MCO[/TD]
[TD]605[/TD]
[TD]143[/TD]
[TD]SW1537[/TD]
[TD]MCO[/TD]
[TD]605[/TD]
[TD]143[/TD]
[/TR]
[TR]
[TD]SW767[/TD]
[TD]BWI[/TD]
[TD]500[/TD]
[TD]143[/TD]
[TD]SW452[/TD]
[TD]BWI[/TD]
[TD]700[/TD]
[TD]137[/TD]
[TD]SW452[/TD]
[TD]BWI[/TD]
[TD]700[/TD]
[TD]137[/TD]
[TD]SW452[/TD]
[TD]BWI[/TD]
[TD]700[/TD]
[TD]137[/TD]
[TD]SW452[/TD]
[TD]BWI[/TD]
[TD]700[/TD]
[TD]137[/TD]
[TD]SW452[/TD]
[TD]BWI[/TD]
[TD]700[/TD]
[TD]137[/TD]
[/TR]
[TR]
[TD]SW3850[/TD]
[TD]TPA[/TD]
[TD]800[/TD]
[TD]143[/TD]
[TD]SW1092[/TD]
[TD]BWI[/TD]
[TD]400[/TD]
[TD]175[/TD]
[TD]SW1092[/TD]
[TD]BWI[/TD]
[TD]400[/TD]
[TD]175[/TD]
[TD]SW1092[/TD]
[TD]BWI[/TD]
[TD]400[/TD]
[TD]175[/TD]
[TD]SW1092[/TD]
[TD]BWI[/TD]
[TD]400[/TD]
[TD]175[/TD]
[TD]SW1092[/TD]
[TD]BWI[/TD]
[TD]400[/TD]
[TD]175[/TD]
[/TR]
[TR]
[TD]SW802[/TD]
[TD]MDW[/TD]
[TD]1750[/TD]
[TD]175[/TD]
[TD]SW767[/TD]
[TD]BWI[/TD]
[TD]500[/TD]
[TD]143[/TD]
[TD]SW767[/TD]
[TD]BWI[/TD]
[TD]500[/TD]
[TD]143[/TD]
[TD]SW767[/TD]
[TD]BWI[/TD]
[TD]500[/TD]
[TD]143[/TD]
[TD]SW767[/TD]
[TD]BWI[/TD]
[TD]500[/TD]
[TD]143[/TD]
[TD]SW767[/TD]
[TD]BWI[/TD]
[TD]500[/TD]
[TD]143[/TD]
[/TR]
[TR]
[TD]SW2513[/TD]
[TD]BWI[/TD]
[TD]1215[/TD]
[TD]143[/TD]
[TD]SW3850[/TD]
[TD]TPA[/TD]
[TD]800[/TD]
[TD]143[/TD]
[TD]SW3850[/TD]
[TD]TPA[/TD]
[TD]800[/TD]
[TD]143[/TD]
[TD]SW3850[/TD]
[TD]TPA[/TD]
[TD]800[/TD]
[TD]143[/TD]
[TD]SW3850[/TD]
[TD]TPA[/TD]
[TD]800[/TD]
[TD]143[/TD]
[TD]SW3850[/TD]
[TD]TPA[/TD]
[TD]800[/TD]
[TD]143[/TD]
[/TR]
[TR]
[TD]SW1533[/TD]
[TD]BWI[/TD]
[TD]1450[/TD]
[TD]143[/TD]
[TD]SW802[/TD]
[TD]MDW[/TD]
[TD]1750[/TD]
[TD]175[/TD]
[TD]SW802[/TD]
[TD]MDW[/TD]
[TD]1750[/TD]
[TD]175[/TD]
[TD]SW802[/TD]
[TD]MDW[/TD]
[TD]1750[/TD]
[TD]175[/TD]
[TD]SW802[/TD]
[TD]MDW[/TD]
[TD]1750[/TD]
[TD]175[/TD]
[TD]SW802[/TD]
[TD]MDW[/TD]
[TD]1750[/TD]
[TD]175[/TD]
[/TR]
[TR]
[TD]SW302[/TD]
[TD]BWI[/TD]
[TD]1705[/TD]
[TD]143[/TD]
[TD]SW2513[/TD]
[TD]BWI[/TD]
[TD]1215[/TD]
[TD]143[/TD]
[TD]SW2513[/TD]
[TD]BWI[/TD]
[TD]1215[/TD]
[TD]143[/TD]
[TD]SW2513[/TD]
[TD]BWI[/TD]
[TD]1215[/TD]
[TD]143[/TD]
[TD]SW2513[/TD]
[TD]BWI[/TD]
[TD]1215[/TD]
[TD]143[/TD]
[TD]SW2513[/TD]
[TD]BWI[/TD]
[TD]1215[/TD]
[TD]143[/TD]
[/TR]
[TR]
[TD]SW750[/TD]
[TD]MDW[/TD]
[TD]1400[/TD]
[TD]175[/TD]
[TD]SW1533[/TD]
[TD]BWI[/TD]
[TD]1450[/TD]
[TD]143[/TD]
[TD]SW1533[/TD]
[TD]BWI[/TD]
[TD]1450[/TD]
[TD]143[/TD]
[TD]SW1533[/TD]
[TD]BWI[/TD]
[TD]1450[/TD]
[TD]143[/TD]
[TD]SW1533[/TD]
[TD]BWI[/TD]
[TD]1450[/TD]
[TD]143[/TD]
[TD]SW1533[/TD]
[TD]BWI[/TD]
[TD]1450[/TD]
[TD]143[/TD]
[/TR]
[TR]
[TD]SW2222[/TD]
[TD]MDW[/TD]
[TD]1830[/TD]
[TD]175[/TD]
[TD]SW302[/TD]
[TD]BWI[/TD]
[TD]1705[/TD]
[TD]143[/TD]
[TD]SW302[/TD]
[TD]BWI[/TD]
[TD]1705[/TD]
[TD]143[/TD]
[TD]SW302[/TD]
[TD]BWI[/TD]
[TD]1705[/TD]
[TD]143[/TD]
[TD]SW302[/TD]
[TD]BWI[/TD]
[TD]1705[/TD]
[TD]143[/TD]
[TD]SW302[/TD]
[TD]BWI[/TD]
[TD]1705[/TD]
[TD]143[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]SW750[/TD]
[TD]MDW[/TD]
[TD]1400[/TD]
[TD]175[/TD]
[TD]SW750[/TD]
[TD]MDW[/TD]
[TD]1400[/TD]
[TD]175[/TD]
[TD]SW750[/TD]
[TD]MDW[/TD]
[TD]1400[/TD]
[TD]175[/TD]
[TD]SW750[/TD]
[TD]MDW[/TD]
[TD]1400[/TD]
[TD]175[/TD]
[TD]SW750[/TD]
[TD]MDW[/TD]
[TD]1400[/TD]
[TD]175[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]SW2222[/TD]
[TD]MDW[/TD]
[TD]1830[/TD]
[TD]175[/TD]
[TD]SW2222[/TD]
[TD]MDW[/TD]
[TD]1830[/TD]
[TD]175[/TD]
[TD]SW2222[/TD]
[TD]MDW[/TD]
[TD]1830[/TD]
[TD]175[/TD]
[TD]SW2222[/TD]
[TD]MDW[/TD]
[TD]1830[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4321[/TD]
[TD]LGA[/TD]
[TD]400[/TD]
[TD]40[/TD]
[TD]DL4321[/TD]
[TD]LGA[/TD]
[TD]400[/TD]
[TD]40[/TD]
[TD]DL4321[/TD]
[TD]LGA[/TD]
[TD]400[/TD]
[TD]40[/TD]
[TD]DL4321[/TD]
[TD]LGA[/TD]
[TD]400[/TD]
[TD]40[/TD]
[/TR]
[TR]
[TD]DL4566[/TD]
[TD]DTW[/TD]
[TD]300[/TD]
[TD]80[/TD]
[TD]DL4566[/TD]
[TD]DTW[/TD]
[TD]300[/TD]
[TD]75[/TD]
[TD]DL4566[/TD]
[TD]DTW[/TD]
[TD]300[/TD]
[TD]75[/TD]
[TD]DL4566[/TD]
[TD]DTW[/TD]
[TD]300[/TD]
[TD]75[/TD]
[TD]DL4566[/TD]
[TD]DTW[/TD]
[TD]300[/TD]
[TD]75[/TD]
[TD]DL4566[/TD]
[TD]DTW[/TD]
[TD]300[/TD]
[TD]75[/TD]
[/TR]
[TR]
[TD]DL3333[/TD]
[TD]ATL[/TD]
[TD]600[/TD]
[TD]100[/TD]
[TD]DL3333[/TD]
[TD]ATL[/TD]
[TD]600[/TD]
[TD]100[/TD]
[TD]DL3333[/TD]
[TD]ATL[/TD]
[TD]600[/TD]
[TD]100[/TD]
[TD]DL3333[/TD]
[TD]ATL[/TD]
[TD]600[/TD]
[TD]100[/TD]
[TD]DL3333[/TD]
[TD]ATL[/TD]
[TD]600[/TD]
[TD]100[/TD]
[TD]DL3333[/TD]
[TD]ATL[/TD]
[TD]600[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]DL2145[/TD]
[TD]LGA[/TD]
[TD]700[/TD]
[TD]68[/TD]
[TD]DL2145[/TD]
[TD]LGA[/TD]
[TD]700[/TD]
[TD]68[/TD]
[TD]DL2145[/TD]
[TD]LGA[/TD]
[TD]700[/TD]
[TD]68[/TD]
[TD]DL2145[/TD]
[TD]LGA[/TD]
[TD]700[/TD]
[TD]68[/TD]
[TD]DL2145[/TD]
[TD]LGA[/TD]
[TD]700[/TD]
[TD]68[/TD]
[TD]DL2145[/TD]
[TD]LGA[/TD]
[TD]700[/TD]
[TD]68[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]UA4567[/TD]
[TD]EWR[/T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TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Totals:[/TD]
[TD][/TD]
[TD][/TD]
[TD]3216[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]3211[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]3211[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]3211[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]3211[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]3211[/TD]
[/TR]
</tbody>[/TABLE]
 
LOL... Solution easier than I expected...

I just added a second sort AFTER the first group sorting. The second sort only sorts the TIME column as the primary sort.
The result is exactly as you need it now.

Code:
Sub SortDateBlocks()
    Dim c As Long
    Dim r As Long
    Dim i As Long
    Dim lr As Long
    Dim A As Range
    Application.ScreenUpdating = False
    For r = 3 To 273 Step 54
        For c = 1 To 31 Step 5
            If Cells(r, c).Offset(1).Value <> "" Then
                With Cells(r, c).Resize(51, 4)
                    .Sort Key1:=.Cells(1), Key2:=.Cells(3), Header:=xlYes
                    lr = Application.CountA(.Columns(1))
                    For i = lr To 2 Step -1
                        If Left(.Cells(i - 1, 1).Value, 2) <> Left(.Cells(i, 1).Value, 2) Then
                            .Cells(i, 1).Resize(lr - i + 1, 4).Copy Destination:=.Cells(i + 1, 1)
                            .Cells(i, 1).Resize(1, 4).ClearContents
                            .Cells(i, 1).Offset(1).CurrentRegion.Sort Key1:=.Cells(3), Header:=xlNo
                            lr = lr + 1
                        End If
                    Next i
                End With
            End If
        Next c
    Next r
    Range("A1").Select
    Application.ScreenUpdating = True
    MsgBox "Dates blocks sorted.", vbInformation
End Sub
 
Upvote 0

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Im going to test it now!!! Do I replace with this code or is this a separate code in addition to the first? Got a runtime error...
 
Last edited:
Upvote 0
funny thing is it works but I still get a runtime error??? And it leaves a blank at the top of each day. The error says "the sort reference is not valid" make sure that it is within the data you want to sort and the first sort by box isn't the same or blank.
 
Last edited:
Upvote 0
I do not get any errors on the file you sent me? Runs smooth as a babies buttocks :)

I'm going to bed soon, but in the meantime, you are welcome to send me a current version that gives the error. I'll take a look at it tomorrow...if you want!
 
Upvote 0
If you insert a blank row below each header row, so that each section is in a separate area, this works fine:

Code:
Sub RD()
  Dim rArea         As Range

  For Each rArea In ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants).Areas
    With rArea
      If .Row > 4 And .Columns.Count = 4 And .Rows.Count > 2 Then
        .Select
        .Sort Key1:=.Cells(3), Header:=xlNo
      End If
    End With
  Next rArea
End Sub

EdiT: Assuming the goal was to sort each section by time.
 
Upvote 0
If you insert a blank row below each header row, so that each section is in a separate area, this works fine:

Code:
Sub RD()
  Dim rArea         As Range

  For Each rArea In ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants).Areas
    With rArea
      If .Row > 4 And .Columns.Count = 4 And .Rows.Count > 2 Then
        .Select
        .Sort Key1:=.Cells(3), Header:=xlNo
      End If
    End With
  Next rArea
End Sub

EdiT: Assuming the goal was to sort each section by time.

The goal is to sort by Airline and then by time....BUT The airlines must be separate meaning the all DLXXXX will come first sorted by time, then all SWXXXX will come next sorted by time....and so on. This has to happen in each "date block". The last post by RudiS almost has it but I get an error.
 
Upvote 0

Forum statistics

Threads
1,223,996
Messages
6,175,862
Members
452,676
Latest member
woodyp

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