Grizlore
Active Member
- Joined
- Aug 22, 2006
- Messages
- 259
Could anyone suggest how I can speed up this code please?
This used to work really quickly, however on my new quicker 'laptop' it takes ages.
I can see in the bottom Excel bar it displaying Calculating (4 processers: x%). Which I have never seen before!
Anyway.. here is the code
Any help in making this do exactly the same job, but be quicker would be appreciated
This used to work really quickly, however on my new quicker 'laptop' it takes ages.
I can see in the bottom Excel bar it displaying Calculating (4 processers: x%). Which I have never seen before!
Anyway.. here is the code
Code:
Sub TrimEVERYTHING()
Dim rng, rngC, rngUnion As Range
Set rng = ActiveSheet.UsedRange
Set rngUnion = Nothing
For Each rngC In rng
If Left(rngC.Formula, 1) <> "=" Then
If rngUnion Is Nothing Then
Set rngUnion = rngC
Else
Set rngUnion = Union(rngUnion, rngC)
End If
End If
Next rngC
For Each rngC In rngUnion
rngC.Value = Evaluate("IF(ROW(" & rngC.Address & "),IF(COLUMN(" & rngC.Address & "),TRIM(" & rngC.Address & ")))")
Next rngC
MsgBox "TRIMMED"
End Sub
Any help in making this do exactly the same job, but be quicker would be appreciated