Sub SortAlphabeticallyDynamic()
Dim ws As Worksheet
Dim lastRow As Long
Dim lastCol As Long
Dim rng As Range
Dim Starting_Cell As Range
' Set the worksheet
Set ws = ActiveSheet
Set Starting_Cell = Range("B3") 'Assuming that the data to be sorted excluding headings starts from cell B3
' Determine the last used row on the column of Starting_Cell
lastRow = ws.Cells(ws.Rows.Count, Starting_Cell.Column).End(xlUp).Row
' Determine the last used column in row the row of Starting_Cell
lastCol = ws.Cells(Starting_Cell.Row, ws.Columns.Count).End(xlToLeft).Column
' Set the dynamic range
Set rng = ws.Range(Starting_Cell, ws.Cells(lastRow, lastCol))
' Sort the range alphabetically
With ws.Sort
.SortFields.Clear
.SortFields.Add Key:=rng.Columns(1), Order:=xlAscending, DataOption:=xlSortTextAsNumbers
.SetRange rng
.Header = xlNo
.MatchCase = False
.Apply
End With
End Sub