Try this code:
Dim lastrow As Long
lastrow = Cells(Rows.Count, 2).End(xlUp).Row
Range("A3:D" & lastrow).Sort key1:=Range("B3:B" & lastrow), _
order1:=xlAscending, Header:=xlNo
More Related Contents:
- How do you change the value of a cell in excel by clicking on it using VBA? [closed]
- How to avoid using Select in Excel VBA
- How do I use FileSystemObject in VBA?
- Is the . in .Range necessary when defined by .Cells?
- Run Excel Macro from Outside Excel Using VBScript From Command Line
- Importing text file into excel sheet
- Loop through each cell in a range of cells when given a Range object
- Checking for #N/A in Excel cell from VBA code
- Non-web SQL Injection
- Error: “Could Not Find Installable ISAM”
- Filling any empty cells with the value above
- Password hash function for Excel VBA
- Create a folder and sub folder in Excel VBA
- Aggregate, Collate and Transpose rows into columns
- One-dimensional array from Excel Range
- How to delete multiple rows without a loop in Excel VBA
- VBA Many buttons point to the same _Click sub
- Excel VBA Filter Change event handler
- How to suppress Update Links warning?
- How do we use restful APIs from Excel macros (vba)?
- Cannot VBA write data to cells in Excel 2007/2010 within a function
- Sorting a dictionary by key in VBA
- VBA paste as values – how to
- How to send email to multiple recipients with addresses stored in Excel?
- What are the benefits of using Classes in VBA? [closed]
- Writing a VLOOKUP function in vba
- Handle cancellation of InputBox to select range
- Type Mismatch in Loop to scan Outlook Messages [duplicate]
- VBA: How to combine two ranges on different sheets into one, to loop through
- How to protect Excel workbook using VBA?