Hi,
I have the following code that helps me to trim certain columns on a worksheet via VBA. The code is part of the macro that I am running. However, the VBA trim code causes the entire macro to run at a very slow pace.
Is it possible to modify the codes such that it will run faster?
Thanks in advance!
I have the following code that helps me to trim certain columns on a worksheet via VBA. The code is part of the macro that I am running. However, the VBA trim code causes the entire macro to run at a very slow pace.
Is it possible to modify the codes such that it will run faster?
Thanks in advance!
Code:
Dim RngZ As Range, C2 As Range, D2 As Range, RngM As Range, RngB As Range, D3 As Range
Set RngZ = Range("B5", Range("D" & Rows.Count).End(xlUp))
For Each C2 In RngZ
C2.Value = Application.Trim(C2.Value)
Next C2
Set RngM = Range("J5", Range("L" & Rows.Count).End(xlUp))
For Each D2 In RngM
D2.Value = Application.Trim(D2.Value)
Next D2