ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 3616|回复: 11

[讨论] IF块没有end if

[复制链接]

TA的精华主题

TA的得分主题

发表于 2009-8-5 22:23 | 显示全部楼层 |阅读模式
请教各位:
如附件,我的代码中明明有if,也有end if.为什么系统说我的块if没有end if.请高手帮我检测下,错在哪里,谢谢了
问题源:选择选项框后,点确定键问题就出来了.

[ 本帖最后由 ccf650 于 2009-8-6 01:05 编辑 ]

book1.rar

153.97 KB, 下载次数: 2

TA的精华主题

TA的得分主题

发表于 2009-8-5 22:29 | 显示全部楼层

回复 1楼 ccf650 的帖子

楼主:附件呢?

TA的精华主题

TA的得分主题

发表于 2009-8-5 22:39 | 显示全部楼层
你是不是在 IF end if 中间有end with 之类的东西呀

TA的精华主题

TA的得分主题

发表于 2009-8-5 22:42 | 显示全部楼层
把代码发上来吧! 别人怎么知道代码错在哪里。

TA的精华主题

TA的得分主题

 楼主| 发表于 2009-8-6 01:05 | 显示全部楼层
不好意思各位,刚才忘记传附件了,现在补传了,麻烦帮看下

3333.rar

164.79 KB, 下载次数: 10

TA的精华主题

TA的得分主题

发表于 2009-8-6 05:46 | 显示全部楼层
If OptionButton1.Value = False And OptionButton2.Value = False Then
If OptionButton2.Value = False And OptionButton3.Value = False Then
  If OptionButton3.Value = False And OptionButton4.Value = False Then
   If OptionButton4.Value = False And OptionButton5.Value = False Then
    If OptionButton5.Value = False And OptionButton6.Value = False Then
     If OptionButton6.Value = False And OptionButton7.Value = False Then
      If OptionButton7.Value = False And OptionButton8.Value = False Then
       If OptionButton8.Value = False And OptionButton9.Value = False Then
        If OptionButton9.Value = False And OptionButton10.Value = False Then
         If OptionButton10.Value = False And OptionButton11.Value = False Then
          If OptionButton11.Value = False And OptionButton12.Value = False Then
           If OptionButton12.Value = False And OptionButton13.Value = False Then
            If OptionButton13.Value = False And OptionButton14.Value = False Then
             If OptionButton14.Value = False And OptionButton1.Value = False Then
MsgBox "请选择您要操作的项目...", 1 + 64, "人力资源管理系统"
    Exit Sub
End If
If OptionButton1.Value = True Then Sheet2.Select Else Sheet3.Select
If OptionButton2.Value = True Then Sheet3.Select Else Sheet4.Select
  If OptionButton3.Value = True Then Sheet4.Select Else Sheet7.Select
   If OptionButton4.Value = True Then Sheet7.Select Else Sheet14.Select
    If OptionButton5.Value = True Then Sheet14.Select Else Sheet13.Select
     If OptionButton6.Value = True Then Sheet13.Select Else Sheet5.Select
      If OptionButton7.Value = True Then Sheet5.Select Else Sheet6.Select
       If OptionButton8.Value = True Then Sheet6.Select Else Sheet11.Select
        If OptionButton9.Value = True Then Sheet11.Select Else Sheet8.Select
         If OptionButton10.Value = True Then Sheet8.Select Else Sheet9.Select
          If OptionButton11.Value = True Then Sheet9.Select Else Sheet12.Select
           If OptionButton12.Value = True Then Sheet12.Select Else Sheet10.Select
            If OptionButton13.Value = True Then Sheet10.Select Else Sheet15.Select
             If OptionButton14.Value = True Then Sheet15.Select Else Sheet2.Select

少end if 少的也太多了点了吧

TA的精华主题

TA的得分主题

发表于 2009-8-6 06:48 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2009-8-6 07:50 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
原帖由 gyzzf 于 2009-8-6 06:48 发表
if..........then后面换行的话,每个if要对应有一个end if

不光少end if  这样的程序看了都头疼

TA的精华主题

TA的得分主题

发表于 2009-8-6 08:07 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2009-8-6 09:34 | 显示全部楼层
呵呵,跟俺水平差不多,要加强学习啊
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-5-23 20:35 , Processed in 0.047921 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表