回去对VBA进行更正

时间:2017-09-20 07:18:16

标签: vba excel-vba autocad excel

我忙于选择输入框,当我做错误时,我想回去进行修正,但我的代码只允许我进行一次选择而不允许我返回并进行修正,例如我选择“是”,然后意识到我想为第一个选项选择“否”,我已经在第二个选项,我希望能够回到我的第一个输入框并选择“否”。这是我的代码

ans = InputBox("1 = Yes" & vbCrLf & "2 = No", "Motor Davit")

Select Case ans
    Case "1":
        : Set layerObj = ThisDrawing.Layers.Add("Motor_Davit_" & Size)
        layerObj.LayerOn = True

    Case "2":
        : Set layerObj = ThisDrawing.Layers.Add("Motor_Davit_" & Size)
        layerObj.LayerOn = False
End Select

ans = InputBox("1 = Yes" & vbCrLf & "2 = No", "Two Pass")

Select Case ans
    'Select whether it's a Two Pass unit or wha
     Case "1":
         : Set layerObj = ThisDrawing.Layers.Add("TWO_PASS_" & Size)
         layerObj.LayerOn = True
     Case "2":
         : Set layerObj = ThisDrawing.Layers.Add("TWO_PASS_" & Size)
         layerObj.LayerOn = False                
     Case Else: MsgBox "Wrong Input Dude.", vbCritical, MSG: Exit Sub
End Select

0 个答案:

没有答案