在编辑单元格时启动VBA宏 [英] Start VBA macro when editing a cell

查看:259
本文介绍了在编辑单元格时启动VBA宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是试图在excel表中写一个搜索宏。在编辑单元格时,如何动态启动宏。当在单元格中写入时,搜索宏应该在后台运行,每个字符都不会在结尾添加或删除。
Worksheet_Change(ByVal Target As Range)仅在编辑完成时返回(返回已被选中或其他单元格被选中)。

I simply try to write a search macro in an excel sheet. How can I start a macro dynamically DURING editing a cell. When writing in a cell the search macro should run in the background with every character added or deleted not just at the end. Worksheet_Change(ByVal Target As Range) only starts when editing is finished (return was hit or other cell was selected).

谢谢。

推荐答案

你不能。当Excel处于编辑模式时,代码引擎将不会运行。您必须让用户在单元格之外输入文本,例如工作表上的控件或用户窗体上的控件。

You can't. The code engine won't run while Excel is in Edit mode. You have to have the user enter the text in something other than a cell - like a control on the worksheet or a control on a userform.

这篇关于在编辑单元格时启动VBA宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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