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
相关推荐
Access开发易登软件12 天前
在 Access 实现标签输入控件:VBA + HTML 混合开发实战
前端·数据库·信息可视化·html·excel·vba·access
VBA633714 天前
如何学习VBA之3.4 初级阶段自测题
vba
yivifu15 天前
使用VBA区分简体中文段落和繁体中文段落的方法
word·excel·vba
VBA633717 天前
VBA之Word应用:在Word中,什么是Range对象
vba
LAM LAB1 个月前
【VBA】Excel指定单元格范围内字体设置样式,处理导出课表单元格
excel·vba
LAM LAB1 个月前
【VBA】Excel实现批量对单元格替换、加粗文字
excel·vba
VBA63371 个月前
VBA技术资料MF432:数组排序
vba
VBA63371 个月前
VBA编程经典460句372-420
vba
VBA63372 个月前
VBA编程经典460句321-370
vba
wei10192 个月前
【Excel VBA基础编程】边玩边学:可视化程序开发
excel·vba·自动化工具