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
相关推荐
VBA63375 天前
AI批量PDF数据抓取工具
vba
Access开发易登软件8 天前
我全新开发了一套 Access 通用 Excel 导入工具,现在开源了
数据库·microsoft·excel·mfc·vba·access·access开发
VBA63378 天前
VBA之Word应用第五章第九节 Range对象的方法(三)
vba
wuchunyu00212 天前
VBA 行内容相同时字体变灰
vba
VBA633716 天前
VBA 64位API声明语句第025讲
vba
Access开发易登软件19 天前
Access 导入 Markdown 表格:把文档里的数据写进表
前端·html·vba·markdown·access开发
zhongwei22825 天前
vba将一个文件夹的内容复制到另外一个文件夹的函数,若存在则是否覆盖的参数。复制前检查源文件夹是否存在。若目标文件夹不存在,则新建
前端·vba
Access开发易登软件1 个月前
Access 复杂业务计算,SQL 写在 VBA 还是存储过程?
microsoft·vba·access·access开发
SunnyDays10112 个月前
如何使用 Python 添加和编辑 Excel VBA 宏(无需安装 Excel)
开发语言·python·excel·vba
taller_20002 个月前
【005】PiE 与传统 VBA 的核心区别
python·vba·pie·py