【问题标题】:Is it quicker to search a column or an array in excel vba?在 excel vba 中搜索列或数组是否更快?
【发布时间】:2015-03-19 23:18:13
【问题描述】:

我有一大列需要搜索的 id。搜索列更快,还是将列加载到数组中然后搜索数组?

【问题讨论】:

    标签: arrays excel vba search


    【解决方案1】:

    这取决于你想要做什么。
    你为什么不计时,自己看看:

    Sub CheckPerformance()
        Dim start
    
        start = Timer
        ' Code that uses searching like looping, or Range Find Method goes here
        Debug.Print (Timer - start) * 1000 ' elapse time in milliseconds
    
        start = Timer
        ' Code that passes values to array and loops goes here
        Debug.Print (Timer - start) * 1000 ' elapse time in milliseconds
    
    End Sub
    

    你会找到答案的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-12
      • 1970-01-01
      • 2011-10-23
      相关资源
      最近更新 更多