高级过滤VBA优秀

时间:2015-06-24 06:23:55

标签: excel excel-vba vba

这是我关于stackoverflow的第一个问题......我还应该说我不是一个非常优秀的程序员。

我有一个大约33000行/ 7列的电子表格,并且必须将具有多个条件(条件数量范围从1到500)的过滤器应用于这些数据。我已经使用Excels高级过滤器编写了一个程序(宏)来自动执行此操作。它效果很好而且非常快(大约0.5秒)。但是,只要我在电子表格上放置一个命令按钮来运行该程序,程序就会减慢到7到180秒之间的任何时间(程序越慢,标准越多)。我到处尝试过/搜索过但是找不到解决方法来解决这个问题!非常欢迎任何帮助!!!

1 个答案:

答案 0 :(得分:0)

你真的需要这个按钮吗?您可以从功能区(Developer >> MacrosSelectionChange)或直接从IDE触发操作。最后,当用户在某个单元格中单击时,您可以尝试按事件('Add in your sheet in Cell E1 text like 'Click to run macro' and 'fill it yellow or with other color to resemble a button 'Goto Sheet module and add the code below- '-check first if you don't have a SelectionChange macro already there Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.EnableEvents = False If Target.Cells.Count = 1 Then If Target.Address(False, False) = "E1" Then Target.Offset(1, 0).Select MyFilteringMacro End If End If Application.EnableEvents = True End Sub )触发操作。见下面的例子。

[
   'attribute' => 'some_title',
    'format' => 'raw',
    'value' => function ($model) {                      
        return '<a href="'.$yourUrl .'">your Text</a>';
    },
],
相关问题