微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

excel vba在选择情况下调用多个子例程

如何解决excel vba在选择情况下调用多个子例程

| 如果我有以下代码
Select Case Number

  Case 1: Call Subroutine1()
  Case 2: Call Subroutine2()
  Case 3: Call Subroutine3()
  Case 4: Call Subroutine4()
  Case 5: Call Subroutine5()
  Case 6: Call Subroutine6()

End Select
我想在情况1中调用几个子例程: 怎么做到呢? 最好,美国     

解决方法

        
Select Case Number

  Case 1: 
    Call Subroutine1a()
    Call Subroutine1b()
    Call Subroutine1c()

  Case 2: Call Subroutine2()
  Case 3: Call Subroutine3()
  Case 4: Call Subroutine4()
  Case 5: Call Subroutine5()
  Case 6: Call Subroutine6()

End Select
    ,        像这样:
Select Case Number

  Case 1: 
      Call Subroutine1a()
      Call Subroutine1b()
  Case 2: Call Subroutine2()
  Case 3: Call Subroutine3()
  Case 4: Call Subroutine4()
  Case 5: Call Subroutine5()
  Case 6: Call Subroutine6()

End Select
    ,        您可以根据需要在每个Case匹配中包含任意数量的语句;
Select Case Number
  Case 1
    Call Subroutine1()
    Call Subroutine2()
  Case 2: Call Subroutine2()
  ...
    

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。