“需要对象"错误424 [英] "Object required" error 424

查看:207
本文介绍了“需要对象"错误424的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2张纸ListComments. List是从另一个导入并设置数据格式的工作表中自动更新的

I have 2 sheets List and Comments. List is auto updated from another sheet that imports and formats data

我想通过双击ID单元格(Range("List!$B$6:$B$22"))来跟踪我们在表List中使用每个对象的频率,但是由于数据总是在改变ID的移动. Comments是所有可能的ID及其注释的列表,但不是导入的值,因此是存储计数数据和最后使用日期的好地方.

I want to keep track of how often we use each object in sheet List by double clicking on the ID cell (Range("List!$B$6:$B$22")) but as the data is always changing the ID's move around. the Comments which is a list of all possible ID's and its comments but not the imported values would be a good place to store count data and last used date.

Private Sub WorkSheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)


If InRange(Target, Range("List!$B$6:$B$22")) Then
    Set c = Worksheets("Comments").Range("$A$2:$A$500").Find(Target.Value)
    If Not c Is Nothing Then
            Set c.Offset(0, 1) = c.Offset(0, 1) + 1
            Set c.Offset(0, 2) = Date
    End If
End If
Cancel = True
End Sub

推荐答案

无需设置

Private Sub WorkSheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("$B$6:$B$22")) Is Nothing Then
    Set c = Worksheets("Comments").Range("$A$2:$A$500").Find(Target.Value)
    If Not c Is Nothing Then
             c.Offset(0, 1) = c.Offset(0, 1) + 1
             c.Offset(0, 2) = Date
    End If
End If
Cancel = True
End Sub

这篇关于“需要对象"错误424的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆