HERE IS A ONE LINE CODE FOR DEVELOPER’S REFERENCE WHICH CAN BE USED TO SORT DATA
'Sort data in ascending order on Column F (Created At)
Sheet1.Range("A1:G" & Sheet1.Cells.SpecialCells(xlCellTypeLastCell).Row).Sort Key1:=Sheet1.Range("F1"), Order1:=xlAscending, Header:=xlYes, DataOption1:=xlSortNormal
After Sort:
IF YOU ARE LOOKING FOR A VBA CODE THAT CAN SORT THE DATA ON MULTIPLE COLUMNS AT THE SAME TIME THEN BELOW CODE MAY HELP YOU:
Public Sub SortByMultipleColumn()
   '
   'Clear old sort field
   Sheet1.Sort.SortFields.Clear
   'Add sort field on column D (Department ID)
   Sheet1.Sort.SortFields.Add Key:=Sheet1.Range("D2:D20"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
   'Add sort field on column F (Created At)
   Sheet1.Sort.SortFields.Add Key:=Sheet1.Range("F2:F20"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
   With Sheet1.Sort
       .SetRange Range("A1:G20")
       .Header = xlYes
       .MatchCase = False
       .Orientation = xlTopToBottom
       .SortMethod = xlPinYin
       .Apply
   End With
   '
End Sub
Before Sort:
After Sort:
VBA Code to Read Outlook Emails Reading emails from Outlook and capture them in Excel file is very common activity being performed in office environment. Doing this activity manually every time is quite boring and…
Excel Files and Sheets Consolidator is an MS Excel based data consolidation tool which can be used to consolidate data from multiple Excel Files or Excel Sheets. The tool supports multiple configurations such as Sheet Name, Sheet Index, Header Row and Non-Blank column to help consolidating accurate data.
Have you ever felt that Microsoft should have added a formula in Excel which can count the cells based on specific color? I have seen many code requests to share a VBA code that can count the cells by its color. To help our subscribers and developers, we are sharing 2 codes that be used to count the cells with specific color and returns the count of the matching color cells.
Outlook Bulk Email Tool is an Excel and Outlook based tool which helps you to send or draft email in bulk right from Excel. It reads the recipient details from Excel sheet and uses Outlook installed on your system to generate emails. The tool supports To, Cc, Subject, Email Body, Attachment, HTML Table in Email Body.
VBA Code To Change Cell Color Excel supports more than 16 million colors in a cell; hence you should know how to set the exact color in a cell. To do this, you can use…
Did you come across any requirement where you want the user to interact with a sheet only through VBA Form? Here is a simple code which can help you here.