fluffynicesheep
Board Regular
- Joined
- Oct 27, 2009
- Messages
- 69
Hi,
I have previously been inserting RSS feeds (as an HTML table) into an excel document and running the below code to update the details and sort by the date column in all tables, when the document opened. When finished the document then saved and closed.
All was working great until I needed to enter some more RSS details, and now there seems to be an issue with doing this ....
I now can only insert data from web as RTF and not HTML, so it no longer goes into a formatted table. I have however added a column to the end of the newly imported data that adds DATEVALUE. I have called this column header DATEVALUE and added filters to the header row.
What I would like to do is add some additional code to the code below that will look through all worksheets, and if it finds a column header that contains the name "DATEVALUE" that it then sorts the rows in descending order. (This could come before or after the current table sort in the code).
Any help would be greatly appreciated.
I have previously been inserting RSS feeds (as an HTML table) into an excel document and running the below code to update the details and sort by the date column in all tables, when the document opened. When finished the document then saved and closed.
All was working great until I needed to enter some more RSS details, and now there seems to be an issue with doing this ....
I now can only insert data from web as RTF and not HTML, so it no longer goes into a formatted table. I have however added a column to the end of the newly imported data that adds DATEVALUE. I have called this column header DATEVALUE and added filters to the header row.
What I would like to do is add some additional code to the code below that will look through all worksheets, and if it finds a column header that contains the name "DATEVALUE" that it then sorts the rows in descending order. (This could come before or after the current table sort in the code).
Any help would be greatly appreciated.
Code:
Private Sub Workbook_Activate()
ActiveWorkbook.RefreshAll
DoEvents
Application.DisplayAlerts = False
Dim ws As Worksheet, t As ListObject
On Error Resume Next
For Each ws In Sheets
For Each t In ws.ListObjects
t.Range.Sort key1:=t.Name & "[DATE]", Order1:=xlDescending
Next
Next
ThisWorkbook.Save
Application.DisplayAlerts = True
Application.Quit
End Sub