Hi Rasm,
Here is my code that i had used in one of my project where i had to sort the Columns based on the date in their first cell value that were containing date in. As you see the range starts at G1 upto it last non blank cell to its right.Then this range got sorted on the behalf of the data in it . Date as data in my case.
Code:Public Sub SortDate_Columns() Dim rngDate As Range Dim rngCell As Range Dim intCol As Integer With ThisWorkbook.Worksheets("TempCalls") Set rngDate = .Range("G1", .Range("G1").End(xlToRight)) Set rngDate = Intersect(rngDate.CurrentRegion, rngDate.CurrentRegion.Offset(0, 6)) With rngDate .Sort .Cells(1), 1, , , , , , xlYes, , , 2 End With End With Set rngDate = Nothing Set rngCell = Nothing End Sub




Reply With Quote
Bookmarks