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