人大的排名规则是按“姓名笔画排序”,本程序排出来的结果正好符合“姓名笔画排序”这规则。
fvENmhYB.rar
(67.82 KB, 下载次数: 22)
而政协、党代会(含地方党委)的排名则是按“姓氏笔画排序”,结果略有不同。因此,要求“姓氏笔画排序”的名单不适合本模块,建议多建一模块适合“姓氏笔画排序”。 一年多前,山版在18楼曾用以下代码解决“姓氏笔画排序”,排序结果正确: Public Function Bhpm(cName As String, Optional cFh As String = " ") As String On Error Resume Next If TypeName(ds) = "Empty" Then Dim nRow%, m% Set ds = CreateObject("scripting.dictionary") '定义字典 nRow = Sheet2.[a65536].End(xlUp).Row hanzi = Sheet2.Range("a1:a" & nRow) For i = 1 To nRow '把汉字添加到字典中 ds.Add hanzi(i, 1), m + 1 If Err.Number = 0 Then m = m + 1 End If Err.Clear Next End If Dim s%, cTxt$, cRow$, nLen%, c As Range temp = Split(cName, cFh) s = UBound(temp) + 1 For i = 1 To s nLen = IIf(Len(temp(i - 1)) > nLen, Len(temp(i - 1)), nLen) Next ReDim arr(1 To s, 1 To 2) For i = 1 To s cTxt = temp(i - 1) arr(i, 1) = cTxt If InStr(cTxt, "(") > 0 Then cTxt = Left(cTxt, InStr(cTxt, "(") - 1) If InStr(cTxt, "(") > 0 Then cTxt = Left(cTxt, InStr(cTxt, "(") - 1) cTxt = Replace(cTxt, " ", "") cTxt = Replace(cTxt, " ", "") If Len(cTxt) < nLen Then cTxt = Left(cTxt, 1) & String(nLen - Len(cTxt), " ") & Mid(cTxt, 2) End If cRow = "" For j = 1 To Len(cTxt) cRow = cRow & IIf(Mid(cTxt, j, 1) = " ", "0000", CStr(Format(ds(Mid(cTxt, j, 1)), "0000"))) Next arr(i, 2) = cRow Next For i = 1 To s - 1 For j = i + 1 To s If arr(i, 2) > arr(j, 2) Then c1 = arr(i, 1) c2 = arr(i, 2) arr(i, 1) = arr(j, 1) arr(i, 2) = arr(j, 2) arr(j, 1) = c1 arr(j, 2) = c2 End If Next temp(i - 1) = arr(i, 1) Next temp(s - 1) = arr(s, 1) Bhpm = Join(temp, cFh) End Function
[此贴子已经被作者于2008-2-15 9:11:20编辑过] |