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
相关推荐
LAM LAB10 天前
【VBA】Excel指定单元格范围内字体设置样式,处理导出课表单元格
excel·vba
LAM LAB12 天前
【VBA】Excel实现批量对单元格替换、加粗文字
excel·vba
VBA633719 天前
VBA技术资料MF432:数组排序
vba
VBA633722 天前
VBA编程经典460句372-420
vba
VBA633723 天前
VBA编程经典460句321-370
vba
wei101925 天前
【Excel VBA基础编程】边玩边学:可视化程序开发
excel·vba·自动化工具
VBA633725 天前
VBA即用型代码手册:自动调整表格大小适应页面Auto Size Table to fit Page
vba
VBA63371 个月前
VBA之Word应用第四章第七节 : 段落Paragraph对象的方法
vba
Access开发易登软件1 个月前
Access 中实现 Web 风格的顶部加载进度条
前端·数据库·vba·access·access开发
LAM LAB1 个月前
【VBA/ppt】设置选中字体为红色
powerpoint·vba·wps