Excel VBA宏来过滤记录 [英] Excel VBA macro to filter records

查看:216
本文介绍了Excel VBA宏来过滤记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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屋!

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