2018年1月小班排序方法

本文介绍了一种使用VBA实现的特殊排序算法,该算法针对特定条件的数据进行处理,包括数据筛选、最大值查找及输出排序后的数据。通过对原始数据进行判断和筛选,实现了有效的排序流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

posted on 2018-01-27 19:42 lbsjs 阅读(...) 评论(...) 编辑 收藏

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值