It now gives error 438 Object doesn't support this property or method at
"With ActiveWorkbook.Worksheets(ActiveSheet.Name).Sort"
Sub marine()
Dim NewRow As Long, NewColumn As Long
Dim X As Long
NewRow = 1
NewColumn = 11
For Col = 1 To 10
For X = 2 To 31
If Cells(X, Col) <> "" Then
Cells(NewRow, NewColumn).Value = Cells(X, Col).Value
NewRow = NewRow + 1
End If
Next
Next
lastrow = ActiveSheet.Cells(Rows.Count, NewColumn).End(xlUp).Row
With ActiveWorkbook.Worksheets(ActiveSheet.Name).Sort
.SetRange Range("P1
" & lastrow)
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub