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
相关推荐
VBA63371 天前
VBA信息获取与处理专题七第二节 网络通信过程的解读
vba
VBA63377 天前
数组与字典解决方案第二十九讲 数组的创建方法小结及回填的注意事项
vba
小妖6661 个月前
excel 怎么在单元格内容自动加上一段文字不能用公式
excel·vba
VBA63371 个月前
VBA之Word应用第五章第五节 Range对象的属性(四)
vba
VBA63371 个月前
VBA信息获取与处理专题七第一节 网络通信基础
vba
yivifu1 个月前
怎样将Word文档中脚注引用后面的空格轻松删除
word·vba
VBA63371 个月前
VBA之Excel应用第五章第四节 变量的生命周期
vba
VBA63371 个月前
VBA中类的解读及应用第三十五讲 类对象的生死轮回----“二师兄”的成长历程之七
vba
SunnyDays10111 个月前
使用 C# 添加、修改和删除 Excel VBA 宏 (无需 Microsoft Office Interop)
c#·excel··vba
VBA63371 个月前
VBA 64位API声明语句第021讲
vba