Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 2640|回复: 1

[已解决]调试finnext函数报错",对象变量或With块变量未设置" 如何解决?

[复制链接]
发表于 2015-3-8 14:45 | 显示全部楼层 |阅读模式
按照微信平台教程调试findnext函数,Loop While Not c Is Nothing And c.Address <> firstAddress报错"对象变量或With块变量未设置",该如何解决?谢谢
本示例在单元格区域 A1:A500 中查找值为 2 的单元格,并将这些单元格的值变为 5。
With Worksheets(1).Range("a1:a500")
    Set c = .Find(2, lookin:=xlValues)
    If Not c Is Nothing Then
        firstAddress = c.Address
        Do
            c.Value = 5
            Set c = .FindNext(c)
        Loop While Not c Is Nothing And c.Address <> firstAddress
    End If
End With
最佳答案
2015-3-8 15:33
倒数第三行改成    Loop While Not c Is Nothing
excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2015-3-8 15:33 | 显示全部楼层    本楼为最佳答案   
倒数第三行改成    Loop While Not c Is Nothing
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-19 05:42 , Processed in 3.356722 second(s), 7 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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