如何在EXCEL中将数字转换成英文字母

1.创建一个模块:在工作表上,右键单击-查看代码。选择“模块”-“插入模块。2.编写代码:选项显式

Dim StrNO(19)作为字符串

将单元(8)调成字符串

dim StrTens(9)As String公共函数Number to String(Number As Double)As String

Dim字符串作为字符串,BeforePoint作为字符串,AfterPoint作为字符串,tmpStr作为字符串

将点标注为整数

将nBit标注为整数

将光标变为字符串

Dim nNumLen为整数

将T标注为字符串

调用Init Str = CStr(Round(Number,2))

Str =数字

If InStr(1,字符串," ")= 0那么

之前点= Str

AfterPoint = " "

其他

BeforePoint = Left(Str,InStr(1,Str," ") - 1)

T = Right(Str,Len(Str) - InStr(1,Str," "))

if Len(T)& lt;2那么AfterPoint = Val(T) * 10

如果Len(T) = 2,则AfterPoint = Val(T)

如果Len(T)>2然后AfterPoint = Val(Left(T,2))

End If If Len(BeforePoint)>那么12

NumberToString = "太大。"

退出功能

如果…就会结束

Str = " "

Do While Len(BeforePoint)>0

nNumLen = Len(BeforePoint)

如果nNumLen Mod 3 = 0,则

CurString = Left(BeforePoint,3)

BeforePoint = Right(BeforePoint,nNumLen - 3)

其他

CurString = Left(BeforePoint,(nNumLen Mod 3))

BeforePoint = Right(BeforePoint,nNumLen - (nNumLen Mod 3))

如果…就会结束

nBit = Len(BeforePoint) / 3

tmp str = decodehunderd(CurString)

if(before point = String(Len(before point)," 0 ")或nBit = 0)且Len(CurString) = 3则

If CInt(Left(CurString,1))& lt;& gt0和CInt(Right(CurString,2))& lt;& gt那么0

tmpStr = Left(tmpStr,InStr(1,tmpStr,Unit(4))+Len(Unit(4))& amp;第八单元& amp”& ampRight(tmpStr,Len(tmpStr) - (InStr(1,tmpStr,Unit(4)) + Len(Unit(4)))

' Else 'If CInt(Left(CurString,1))& lt;& gt0且CInt(Right(CurString,2)) = 0,则

tmpStr =单元(8)和amp”& amptmpStr

如果…就会结束

如果nBit = 0,则结束If

Trim(Str & amp;”& amptmpStr)

其他

Trim(Str & amp;”& amptmpStr & amp”& amp单位(nBit))

如果…就会结束

如果Left(Str,3) = Unit(8),则Str = Trim(Right(Str,Len(Str) - 3))

如果before point = String(Len(before point)," 0 "),则退出Do

调试。打印字符串

before point = Str If Len(after point)>那么0

AfterPoint = Unit(8)和amp”& amp第七单元& amp”& amp解码器(AfterPoint)和”& amp第五单元

其他

AfterPoint =单位(5)

如果…就会结束

NumberToString = before point & amp;”& amp后点

结束功能

私有函数DecodeHundred(百字符串作为字符串)作为字符串

将tmp标注为整数

If Len(百字符串)>0和Len(百字符串)& lt那么= 3

选择大小写长度(百字符串)

案例1

tmp = CInt(百字符串)

如果tmp & lt& gt0然后decodehunderd = StrNO(tmp)

案例2

tmp = CInt(百字符串)

如果tmp & lt& gt那么0

if(tmp & lt;20)然后

decodehunderd = StrNO(tmp)

其他

如果CInt(Right(百字符串,1)) = 0,则

decodehunderd = StrTens(Int(tmp/10))

其他

decodehunderd = StrTens(Int(tmp/10))& amp;“-”& amp;StrNO(CInt(Right(百字符串,1)))

如果…就会结束

如果…就会结束

如果…就会结束

案例3

If CInt(Left(百字符串,1))& lt;& gt那么0

decodehunderd = StrNO(CInt(Left(百字符串,1))& amp;”& amp第四单元& amp”& ampDecodeHundred(右(百进制字符串,2))

其他

decodehunderd = decodehunderd(Right(百进制字符串,2))

如果…就会结束

其他情况

结束选择

结束IfEnd函数

私有Sub Init()

if StrNO(1)& lt;& gt那就一个吧

StrNO(1) = "一"

StrNO(2) = "二"

StrNO(3) = "三"

StrNO(4) = "四"

StrNO(5) = "五"

StrNO(6) = "六"

StrNO(7) = "七"

StrNO(8) = "八"

StrNO(9) = "九"

StrNO(10) = "十"

StrNO(11) = "十一"

StrNO(12) = "十二"

StrNO(13) = "十三"

StrNO(14) = "十四"

StrNO(15) = "十五"

StrNO(16) = "十六"

StrNO(17) = "十七"

StrNO(18) = "十八"

StrNO(19) = "十九"个StrTens(1) = "十"

StrTens(2) = "二十"

StrTens(3) = "三十"

StrTens(4) = "四十"

StrTens(5) = "五十"

StrTens(6) = "六十"

StrTens(7) = "七十"

StrTens(8) = "八十"

STRTENS (9) = "九十"单位(1) = "思想"'物质?六月

单位(2) = "百万" '素材?六月

单元(3) =“十亿”'素材?六月

单位(4) = "百"

单元(5) =“仅”

单元(6) = "点"

单位(7) =“分”

单元(8) = "和"

如果…就会结束

End Sub将此代码保存在本地。3.模块中已经定义了函数名:NumberToString可以直接作为EXCEL局部函数使用。比如在A1=7中,在B1中输入= =NumberToString(A1+0)来拉!