|
邮件今天凌晨已经发送
望查收
——别人的电脑是电脑,偶的电脑咋就是牛车捏
收到 ——ldy
- '论坛ID:biaotiger1 ok +3
- 'Option Explicit
- Function N2Char26R(ByVal L As String) As Double
- '你的代码 要求EXCEL2003下可运行
- '要求不仅限于 2003的IV(256) 和 2007 的XFD(16384列)
- '具体要求请运行 验证1
- Dim N As Double, K As Byte, I As Byte, C As Integer
- C = Len(L)
- For I = 1 To C
- K = Asc(UCase(Mid(L, I, 1))) - 64
- N = N + K * 26 ^ (C - I)
- Next
- N2Char26R = N
- End Function
- Function N2Char26(ByVal L As Double) As String
- '你的代码 要求EXCEL2003下可运行
- '具体要求请运行 验证2
- Dim iMod As Integer, sChar As String, K As Integer, X As Integer
- Dim Temp As Double, M As Double
- iMod = Int(WorksheetFunction.Log(L, 26))
- For X = iMod To 0 Step -1
- K = Int(L / 26 ^ X)
- Temp = K * 26 ^ X
- For M = 0 To X - 1
- Temp = Temp + 26 ^ M
- Next M
- If Temp > L Then
- K = IIf(Int(L / 26 ^ X) = 1, 0, K - 1)
- End If
- L = L - K * 26 ^ X
- sChar = sChar & Chr(K + 64)
- Next
- sChar = IIf(Left(sChar, 1) = "@", Right(sChar, Len(sChar) - 1), sChar)
- N2Char26 = sChar
- End Function
复制代码
[ 本帖最后由 ldy 于 2009-10-21 17:09 编辑 ] |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?免费注册
x
评分
-
1
查看全部评分
-
|