我以前做过这个,但已经很多年了。 拿这个代码:
Set Find = r.Find(Text, LookIn:=xlFormulas, lookat:=xlWhole)这在我拥有的宏中运行。 问题是,当我使用CTRL + F进行常规查找时,我的宏代码中使用的参数将被保存。 我通常喜欢在单元格内容中搜索,而不是像上面代码那样搜索整个单元格。 扩展查找选项并在每次打开查找窗口时取消选中“匹配整个单元格内容”,这有点痛苦。
我以前做的是将当前的查找设置保存到变量,运行.Find(),然后将参数设置回原来的样子,但我无法弄明白。
I've done this before, but it's been many years. Take this code:
Set Find = r.Find(Text, LookIn:=xlFormulas, lookat:=xlWhole)This runs in a macro I have. The problem is that when I go to do a regular find with CTRL+F, the parameters used here in my macro code are saved. I normally like to search within the cell contents, not the whole cell like what the above code does. It's a bit of a pain to expand the find options and uncheck "Match entire cell contents" every time I open the find window.
What I used to do was save the current find settings to a variable, run .Find(), then set the parameters back to what they were, but I can't figure it out.
最满意答案
在代码结束时,当您完成所需操作后,只需将其设置为:
Set Find = r.Find(Text, LookIn:=xlValues, lookat:=xlPart)At the end of your code, when you're done what you need to do, just set it back:
Set Find = r.Find(Text, LookIn:=xlValues, lookat:=xlPart)更多推荐
发布评论