코드를 사용할 수있는 경우 당신이 원하는 방법 정보를 정렬하려면 다음과 같은 하위를 사용 :이 서브는 귀하의 정보는 정렬 할 경우에만 정보가 해당 열에 것을 1 열에하고 있다고 가정
Option Explicit
Sub SortStrings()
'This sub will sort the values in column 1 by year and then by quarter based on
'the format of "Q1FY14"
'
'Written by TheEngineer on 12/10/2014
Dim LastRow As Long
Dim qCount As Long
Dim i As Long, j As Long, k As Long
Application.ScreenUpdating = False
With ActiveSheet
LastRow = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To LastRow
For j = i + 1 To LastRow
If CInt(Right(.Cells(j, 1).Value, 2)) > CInt(Right(.Cells(i, 1).Value, 2)) Then
If j <> i + 1 Then
.Cells(j, 1).Cut
.Cells(i + 1, 1).Insert Shift:=xlDown
End If
Else
.Cells(j, 1).Cut
.Cells(i, 1).Insert Shift:=xlDown
End If
Next j
Next i
qCount = 0
For i = 1 To LastRow
For j = i + 1 To LastRow
If CInt(Right(.Cells(j, 1).Value, 2)) = CInt(Right(.Cells(i, 1).Value, 2)) Then
qCount = qCount + 1
End If
Next j
For k = i + 1 To qCount + i
If CInt(Left(Right(.Cells(k, 1).Value, Len(.Cells(k, 1).Value) - 1), 1)) > CInt(Left(Right(.Cells(i, 1).Value, Len(.Cells(i, 1).Value) - 1), 1)) Then
If k <> i + 1 Then
.Cells(k, 1).Cut
.Cells(i + 1, 1).Insert Shift:=xlDown
End If
Else
.Cells(k, 1).Cut
.Cells(i, 1).Insert Shift:=xlDown
End If
Next k
qCount = 0
Next i
End With
Application.ScreenUpdating = True
End Sub
참고.
이것은 필요한만큼의 문자열에서 작동합니다.
아래 답변 중 하나가 효과가 있습니까? – TheEngineer