一般的排序都整行移动的。但是有这种情况的除外:如b列整列是空白的,按a列排序,c列以后的内容是不会跟着变化的,删除b列后就跟着变化了。
Sub s()
a = Array("√", "X", "")
Set rg = [a6].CurrentRegion
k = rg.Columns.Count + 1
Do
k = k - 1
Set c = Columns(k).Find("√", lookat:=xlWhole)
If c Is Nothing Then
Set c = Columns(k).Find("X", lookat:=xlWhole)
End If
Loop While c Is Nothing
Set c = rg.Item(rg.Count)
arr = Range([a6], c)
r = 6
For i = 0 To 2
For j = 1 To UBound(arr)
If arr(j, k) = a(i) Then
For ii = 1 To UBound(arr, 2)
Cells(r, ii) = arr(j, ii)
Next
r = r + 1
End If
Next j, i
End Sub