在excle中怎样执行主过程和子过程

 时间:2024-10-12 01:43:49

1、打开excle软件,进入VBA的编程界面,打开其中一个模块进行编辑,事先做好了几个子过程和函数,GetUsername,GetFirst,GetLast,DisplayLastFirst

在excle中怎样执行主过程和子过程

3、然后定义变量Dim full As String, first As String, last As String

在excle中怎样执行主过程和子过程

5、再调用GetFirst,获得名字的第一个。first = GetFirst(full)

在excle中怎样执行主过程和子过程

7、最后调用DisplayLastFirst,用来输出名字。Call DisplayLastFirst(first, last)完整代码如下:Sub UserName() Dim full As String, first As String, last As String Call GetUsername(full) first = GetFirst(full) last = GetLast(full) Call DisplayLastFirst(first, last) End SubSub GetUsername(fullname As String) fullname = InputBox("请输入你的第一个名字和最后一个名字")End SubFunction GetFirst(fullname As String) Dim space As Integer space = InStr(fullname, " ") GetFirst = Left(fullname, space - 1)End FunctionFunction GetLast(fullname As String) Dim space As Integer space = InStr(fullname, " ") GetLast = Right(fullname, Len(fullname) - space) End FunctionSub DisplayLastFirst(first, last) MsgBox first & "," & lastEnd Sub

在excle中怎样执行主过程和子过程
  • Excel中的单选按钮案例
  • 教你execl技巧输入中文序号的方法
  • Excel怎么打开Power Query编辑器
  • excel小技巧使用切片器一秒让自己的图表动起来
  • Excel某字段逗号和空格夹杂无法完成分列操作
  • 热门搜索
    怎么去除颈纹 肝脏囊肿是怎么回事 热感冒的症状 河姆渡遗址博物馆 不大便怎么办 多姿多彩的近义词 次方怎么打 感冒咳嗽有痰吃什么药 梦寐以求的近义词 流淌的近义词