Auto sorting table based on date

Enzo_Matrix

Board Regular
Joined
Jan 9, 2018
Messages
113
I have a table that I update continuously with new information. This is table is then filtered to three seporate sheets with the following code
Code:
Sub FilterCopy()   
   Dim Ary As Variant
   Dim i As Long
   Dim Sht As Variant
   
   Ary = Array("Weld", "Composite", "Rubber")
   For Each Sht In Ary
      Sheets(Sht).UsedRange.ClearContents
   Next Sht
   With Sheets("Data")
      If .AutoFilterMode Then .AutoFilterMode = False
      For i = 0 To UBound(Ary)
         .Range("A4").AutoFilter 1, Ary(i)
         On Error Resume Next
         .UsedRange.Offset(1).SpecialCells(xlVisible).Copy Sheets(Ary(i)).Range("A" & Rows.Count).End(xlUp).Offset(1)
         On Error GoTo 0
      Next i
      .AutoFilterMode = False
   End With
End Sub

I am wondering if there is something I can add to this code above or new code I can add in order to sort my table based on the dates entered in column G, oldest to newest.

Table parameters:
- has headers
- Headers are in cells A1 - H1
- data starts in A2 through to H85 (this will increase as more data is added)
- Dates are in G
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,215,560
Messages
6,125,523
Members
449,236
Latest member
Afua

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