| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
共有 116 人关注过本帖
标题:运行时错误'424' 要求对象
只看楼主 加入收藏
leij
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2020-6-8
结帖率:100%
收藏
 问题点数:0 回复次数:0 
运行时错误'424' 要求对象
调试的时候,标亮的错误点:          Load UserForm1

代码如下:
Option Explicit
Public frmStatus As String
Public rowNum As Integer

Sub 查询员工信息()
     Dim strS As String
     Dim intRow As Integer
     Dim rngNum As Range, rngName As Range

     strS = InputBox("请输入员工的编号或姓名", "员工查询")
     If strS <> "" Then
         Set rngNum = Sheets("员工个人信息表").UsedRange.Find("编号")
         Set rngName = Sheets("员工个人信息表").UsedRange.Find("姓名")
         
         If rngNum Is Nothing Or rngName Is Nothing Then
              MsgBox "员工个人信息表错误,无法进行操作"
              Exit Sub
         End If
         
         intRow = -1
         Set rngNum = rngNum.EntireColumn.Find(strS)
         
         If rngNum Is Nothing Then
             Set rngName = rngName.EntireColumn.Find(strS)
             If Not (rngName Is Nothing) Then
                 intRow = rngName.Row
             End If
         Else
             intRow = rngNum.Row
         End If
            
         If intRow > 0 Then
            frmStatus = "查询"
            rowNum = intRow
            Load UserForm1
            UserForm1.Show
         Else
            MsgBox "没找到与“" & strS & "”相关数据!", , "提示"
         End If
    End If
   
End Sub
搜索更多相关主题的帖子: 员工 If 信息 Then End 
2020-06-08 12:03
快速回复:运行时错误'424' 要求对象
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.050254 second(s), 8 queries.
Copyright©2004-2020, BCCN.NET, All Rights Reserved