带有 Select Case 的 Excel VBA 运行时错误 13

罗伯特W081171

我有一些嵌套Select Case代码,当我选择主案例 2、3、4 或 5 时(我得到每个案例的嵌套案例选项),我有一些嵌套代码,但是当我选择时,Case 1我得到一个运行时错误 13,它忽略了定义选项的输入框。

我已经看了一百遍,但看不到我的错误在哪里,某处必须有一个,想知道是否有人可以看到这里缺少什么或错误,这是我的代码中引发错误的部分。


Variants:

Sizes = Application.InputBox("Which EMS 066 option do you wish to load & check against" & vbLf & vbLf & vbLf & "1. S690 All variants & sizes" & vbLf & vbLf & "2. S890 All variants & sizes" & vbLf & vbLf & "3. S960 All variants & sizes" & vbLf & vbLf & "4. S650MC-D All sizes" & vbLf & vbLf & "5. S700MC-D All sizes" & vbLf & vbLf & vbLf, "Select which option to load")

If Sizes = False Then
    Exit Sub
Else
    Select Case Sizes
        Case 1
            ws.Activate
            Ans = MsgBox("You have selected S690 variant?", vbYesNo) ' allows a loop if you have made a mistake and will take you back to the selection option
            If Ans = vbNo Then GoTo Variants Else
                Option1 = Application.InputBox("Please define the specific type and size of S690 you require to check against" & vbLf & vbLf & "1. S690Q 3mm to 50mm" & vbLf & "2. S690Q 50 to 100mm" & vbLf & "3. S690Q100 to 150mm" & vbLf & vbLf & "4. S690QL 3 to 50mm" & vbLf & vbLf & "5. S690QL 50 to 100mm" & vbLf & vbLf & "6. S690QL 100 to 150mm" & vbLf & vbLf & "7. S690QL1 3 to 50mm" & vbLf & vbLf & "8. S690QL1 50 to 100mm" & vbLf & vbLf & "9. S690QL1 100 to 150mm" & vbLf & vbLf, "Plese select the Option from the Drawing")

                Select Case Option1
                    Case 1
                        Ans = MsgBox("You have selected S690Q between 3 and 50mm is this correct?", vbYesNo) ' allows a loop if you have made a mistake and will take you back to the selection option
                        If Ans = vbNo Then GoTo Variants Else:
                            rng2.Copy: rng1.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks _
                              :=False, Transpose:=False
                            rng4.Copy: rng3.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks _
                              :=False, Transpose:=False
                            rng6.Copy: rng5.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                              :=False, Transpose:=False

这让我一整天都发疯了,我一生都看不到哪里出了问题,我什至从第二个主要内容中复制了代码Case Select并尝试了未经编辑和编辑的代码,但我得到了同样的错误。

约亨

输入框的提示最多可以有 255 个字符。如果它有更多,你会得到错误 2015。如果你来到你的第二个Select Case,你将错误1与错误 13进行比较并得到错误 13。

所以:在情况 1 中缩短你的提示,你很好:)

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

运行时错误13 VBA Excel

带有 .quit 的 vba excel 运行时错误 438

Excel VBA运行时错误类型不匹配13

Excel VBA运行时错误“ 13”:类型不匹配

运行时错误13 VBA Excel 2007

Excel VBA If语句多条件运行时错误13

运行时错误 13' 类型不匹配 VBA excel

VBA Excel中的“运行时错误13:类型不匹配”错误

调用带有对象作为参数的子例程时的运行时错误Excel VBA

带有 listobjects.add 的 Excel 2013 VBA 运行时错误 5

Application.Wait和Excel VBA运行时错误'13'类型不匹配

Excel运行时错误13中的VBA:类型不匹配

Excel VBA数据透视缓存类型不匹配运行时错误'13'

运行时错误'13:比较日期时键入不匹配-EXCEL VBA

VBA中带有变量的动态范围的“运行时错误13”。数据类型不匹配

Excel VBA运行时错误1004

尝试检测是否关闭了用户窗体时在Excel VBA中得到“运行时错误'13':类型不匹配”

Excel VBA运行时错误“ 13”:将变量数组传递给Application.Index方法时,类型不匹配

VBA Excel:将范围内容放入数组时出现运行时错误 13 - 长单元格内容

我在VBA excel中编写编码器。我不断收到运行时错误13。它说不匹配

运行时错误,变量不匹配,没有导出,缺少模块引用EXCEL VBA

使用 ElseIf / If / Else 在 VBA 上运行时错误 13

Excel Application.Match运行时错误'13'

VBA Excel 错误运行时错误“53”

Excel VBA:运行时错误(对象“范围”的方法“值”失败),但仅在连续运行时

Excel VBA:.find函数返回运行时错误91

Excel VBA运行时错误91无法解决

Excel VBA 运行时错误 1004 - ThisWorkbook.Connections

Excel VBA-运行时错误1004