MS Excel VBA查找带有string值的单元格
我很难找出最好的方法来查找和replace值超过4000行的string值应该是数值。
客户收集几个工作簿,并希望巩固他们。 我有这样的工作,但一个特定的列应该是一个数值,但偶尔报告系统会倾倒出一个无关的string在该列中。
这是我现在用VBA做的事情
For Each r in rng if not IsNumeric(r.value2) then r.value=null Next r
正如你可以想象的,这个for / next循环需要一段时间才能运行。 有一个更好的方法来处理这个问题。 任何帮助,将不胜感激。
谢谢,弗雷德
PS:我已经玩弄了。find和replace,但不能让他们工作。
尝试使用specialcellsfunction
on error resume next 'in case there are no string cells rng.specialcells(xlCellTypeConstants,2).clear on error goto 0