VBA Excel口算题

口算题函数

利用随机数写个20以内加减法口算题函数

vbscript 复制代码
Function Kousuan()
    Dim intOne As Integer
    Dim intTwo As Integer
    Dim strFlg As String
    Dim intFlg As Integer
    Dim strRtn As String
    
    intFlg = Application.WorksheetFunction.RandBetween(0, 1)
    strFlg = "-"
    If intFlg = 0 Then strFlg = "+"
    
    intOne = Application.WorksheetFunction.RandBetween(10, 20)
    intTwo = Application.WorksheetFunction.RandBetween(1, 20)
    
    If strFlg = "-" Then
        If intOne > intTwo Then
            strRtn = intOne & strFlg & intTwo & "="
        Else
            strRtn = intTwo & strFlg & intOne & "="
        End If
    Else
        strRtn = intOne & strFlg & intTwo & "="
    End If
    
    shuxue = strRtn
End Function
相关推荐
zhongwei2285 天前
vba将一个文件夹的内容复制到另外一个文件夹的函数,若存在则是否覆盖的参数。复制前检查源文件夹是否存在。若目标文件夹不存在,则新建
前端·vba
Access开发易登软件14 天前
Access 复杂业务计算,SQL 写在 VBA 还是存储过程?
microsoft·vba·access·access开发
SunnyDays10111 个月前
如何使用 Python 添加和编辑 Excel VBA 宏(无需安装 Excel)
开发语言·python·excel·vba
taller_20001 个月前
【005】PiE 与传统 VBA 的核心区别
python·vba·pie·py
VBA63372 个月前
VBA密匙暗码加密技术
vba
VBA63372 个月前
VBA代码加密解决方案目录及说明
vba
VBA63372 个月前
如何学习VBA之2.1.3 VBA的错误处理
vba
VBA63372 个月前
VBA高级应用30例 应用6 第5部分:5 利用VBA从XML文件中导出数值数据
vba
VBA63373 个月前
VBA信息获取与处理专题七第二节 网络通信过程的解读
vba
VBA63373 个月前
数组与字典解决方案第二十九讲 数组的创建方法小结及回填的注意事项
vba