|
楼主 |
发表于 2019-10-31 18:41
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
注:此亦为不知名的作者的成果。函数作用:计算20000余个汉字的笔画Function STROCK(CHNCHR As String) STR1 = "与之及夨扌3,尣乏以夃巨4,卍歺伋印回夗5,仮似吸攰6,尦巫镸飏7,乸尩芈受烎鼡8,巻拏叟埩婙9,弬彧袅欫镹琤訚10,彪兞将晘梡祡営惸掽描毮逽镺匓碀11,"
STR2 = "晩鹀黄僆嗒搑斞斱殾溬溾遚镻飱黾廐12,媐戡琞缙臦勨厯奥掴槩滫潃舝蔜蜀澕诤踭13,怄歌熓獒僶儁墟寿嶑憈撗敻暮昵毃氁獡裦鄳镌閰养铮14,"
STR3 = "婵摾晔槪誾憴懊擑渑澫濈濍縙諩錓镼餝15,碛膐輤錻阛韰厳殩濭篹襃餴鴱鼋龟鵖16,燛簔闀謰哗鎹鎾饂黝鼀鵧兤剩17,藔羀臩荠鯐鹀斋夓瀢绳繱蝇譃鏅鏎鞳顝鲞鹱鼃18,"
STR3 = "儱陇馦齁匶襕譝譢鐅镽騪魓鯺鰙鼅鼅19,嚺蘤咙垄宠巃徿拢泷璺舋茏腾咸櫹櫹疉疉灶灶鐽鐽饏饏騿騿鬕鬕驆驆赢20,昽栊爖珑辟闦鷌龡龡谪谪镾镾鷝鷝鷨龝21,眬眬砻砻竉竉龢讉鱋鷬鷵鼆22,"
STR4 = "爢爢巅巅櫷櫷笼笼聋聋蠪蠪袭袭雠雠鬛鬛麟麟蠲鱦鱪鳖骡23,爤爤虁虁詟贚碱纛讙鱰鹱鼍24,鑨鬬鸂鑶鱱鼊25,斗虌讝阄26,驡龞27,鱹28,龖36,齉37,靐39,龘51"
STR1234 = STR1 + STR2 + STR3 + STR4
On Error Resume Next
N = WorksheetFunction.Find(CHNCHR, STR1234)
If N > 0 Then
CN = "0"
For i = N To Len(STR1234)
CHAR0 = Mid(STR1234, i, 1)
If CHAR0 <> "," Then
If Asc(CHAR0) <= 57 And Asc(CHAR0) > 47 Then
CN = CVar(CN) * 10 + CVar(CHAR0)
End If
Else
STROCK = CInt(CN)
Exit Function
End If
Next i
Else
Workbooks.Add
tembook = ActiveWorkbook.Name
STR0 = "一丁万不且丞丣并临丵干亁乱僊僵亸偿儭龎龏龑龒龓儾囔圞灥囖纞厵滟灪爩龗齾"
For i = 1 To 35
Workbooks(tembook).Sheets(1).Range("A" + Trim(i + 1)).Value = i
Workbooks(tembook).Sheets(1).Range("B" + Trim(i + 1)).Value = Mid(STR0, i, 1)
Next i
Workbooks(tembook).Sheets(1).Range("B" + Trim(i + 1)).Value = CHNCHR
Workbooks(tembook).Sheets(1).Range("A2:b37").Sort Key1
= Range("B2"), Order1
= xlAscending, Header
= xlGuess, OrderCustom
= 1, MatchCase
= False, Orientation
= xlTopToBottom, _
SortMethod
= xlStroke, DataOption1
= xlSortNormal
STROCK = (Workbooks(tembook).Sheets(1).Range("A2").End(xlDown).Value)
End If
Application.DisplayAlerts = False
Workbooks(tembook).Close
Application.DisplayAlerts = True
End Function
|
|