Speed up excel formatting vba code?

前端 未结 2 1519
隐瞒了意图╮
隐瞒了意图╮ 2021-01-26 03:13

I am using the following vba code to change a text string date into an actual date in excel so I can use it for logical comparisons and the like.

The problem is I need t

2条回答
  •  渐次进展
    2021-01-26 03:21

    It would be better to get the values in to an array in one single "pull", operate on the array and write it back. That would circumvent the expensive range operation.

    dim c as range
    set c = Range("D2:D" & Range("D" & Rows.Count).End(xlUp).Row)
    
    dim ArrValue() as Variant
    
    set ArrValue = c.value
    

    next step: iterate over that array and then write back:

    c.value = Arrvalue
    

    I have no time to test the code, so please correct it for yourself, I am sorry.

提交回复
热议问题