Excel VBA宏来过滤记录 [英] Excel VBA macro to filter records
问题描述
我有一个excel文件,在第一个表格中有总计数状态 active
是59行状态过时
10 rows。
在第二个工作表中有59条记录的状态栏,如 ACTIVE
AND OBSOLETE
。
我想创建一个宏来选择记录,通过点击一个按钮来过滤记录 ACTIVE
或 OBSOLETE
使用VBA。
自动生成VBA代码的一种方法是如果您只是直接在工作簿中工作,请记录宏的步骤。记录宏之后,您可以查看由宏生成的VBA代码,并根据需要进行修改。
记录一个新的宏:转到查看标签,然后宏,然后记录宏 / strong>。
查看宏VBA代码:
$转到查看标签,然后宏,然后查看宏,然后选择您想要的宏查看并单击编辑。
希望这可以帮助您开始。
享受!
I have an excel file, In the first sheet it has data like total count with status active
is 59 rows status obsolete
10 rows.
In the second sheet with 59 records with status column like ACTIVE
AND OBSOLETE
.
I want to create a macro to select records by clicking a button it has to filter records ACTIVE
or OBSOLETE
using VBA.
One way to auto generate the VBA code is to record a macro of the steps you would take to do this if you were just working directly in the workbook. After you have the macro recorded you can look at the VBA code generated by the macro and modify as necessary.
To record a new macro:
- Go to the View Tab then Macros then Record Macro.
To view the macro VBA code:
- Go to the View Tab then Macros then View Macros then select the macro you want to view and click edit.
Hope this help you get started.
Enjoy!
这篇关于Excel VBA宏来过滤记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!