2018年1月小班排序方法
Sub xyf()
Dim arr()
Dim arr1(1 To 3000)
arr = Range("f1:f600")                   //  需要排序的列
arr = Application.WorksheetFunction.Transpose(arr)
arrconut = UBound(arr)
b = 1
For a = 1 To arrconut Step 1
 If arr(a) < 8000 Then
   arr1(b) = arr(a)
   b = b + 1
   End If
   Next
   
maxban = Application.WorksheetFunction.Max(arr1)
maxnban = Application.WorksheetFunction.Max(arr)
Cells(1, 1).Value = arr(1)                                             //输出列
For i = 1 To arrconut Step 1
 If i = arrconut Then
   Exit For
End If
fban = arr(i)
sban = arr(i + 1)
If fban <> sban Then
    Cells(i + 1, 1).Value = sban                                              //输出列
End If
If fban = sban Then
  If fban >= 8000 Then
       maxnban = maxnban + 1
       Cells(i + 1, 1).Value = maxnban                                    //输出列
     Else
     maxban = maxban + 1
     Cells(i + 1, 1).Value = maxban                                      //输出列
     End If
End If
Next
End Sub
 
                    
                     
                    
                 
                    
                 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号