Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've tried the below function over a range of 6000 cells.
'====================================== Private Function TrimAll(myTrimArea As Range) Dim cell For Each cell In myTrimArea.Cells cell.Value = Trim(cell.Value) Next cell End Function '====================================== .....it's very slow. What is wrong with my code ? Any help greatly appreciated J |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This should help considerably, it turns off all processing, does the work,
and then calculates once instead of thousands of times. Private Function TrimAll(myTrimArea As Range) Dim cell Application.ScreenUpdating = False Application.Calculation = xlCalculationManual For Each cell In myTrimArea.Cells cell.Value = Trim(cell.Value) Next cell Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic End Function -- -John Please rate when your question is answered to help us and others know what is helpful. "WhytheQ" wrote: I've tried the below function over a range of 6000 cells. '====================================== Private Function TrimAll(myTrimArea As Range) Dim cell For Each cell In myTrimArea.Cells cell.Value = Trim(cell.Value) Next cell End Function '====================================== .....it's very slow. What is wrong with my code ? Any help greatly appreciated J |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Re-calculate function too slow | Excel Discussion (Misc queries) | |||
slow replace function | Excel Worksheet Functions | |||
Slow Function | Excel Programming | |||
macro function is too slow! | Excel Programming | |||
Optimize Slow function | Excel Programming |