Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default Speed up Code?

Hi All,

In order to clean up some downloaded figures I run the following sub.
It works fine!!!

Sometimes I have the impression though that routine is calculating
rather slow.
It gets through but ...it takes
(sometimes looots of..)time.

Is there a way to speed up the routine???

Public Sub BlanksToNumbers()
Dim r As Range
Dim w As Worksheet
On Error GoTo err
Application.ScreenUpdating = False
For Each w In ActiveWorkbook.Worksheets
For Each r In w.UsedRange.Cells
r.Cells.Font.Name = "Arial"
If r.TEXT = "" And r.Formula = "" Then r.Value = ""
Next r
Next w
Application.ScreenUpdating = True
err:
End Sub

Cheeers Sige

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default Speed up Code?

you can try this at the beginning
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False

and this at the end

With Application
CalcMode = .Calculation
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True


--


Gary


"Sige" wrote in message
oups.com...
Hi All,

In order to clean up some downloaded figures I run the following sub.
It works fine!!!

Sometimes I have the impression though that routine is calculating
rather slow.
It gets through but ...it takes
(sometimes looots of..)time.

Is there a way to speed up the routine???

Public Sub BlanksToNumbers()
Dim r As Range
Dim w As Worksheet
On Error GoTo err
Application.ScreenUpdating = False
For Each w In ActiveWorkbook.Worksheets
For Each r In w.UsedRange.Cells
r.Cells.Font.Name = "Arial"
If r.TEXT = "" And r.Formula = "" Then r.Value = ""
Next r
Next w
Application.ScreenUpdating = True
err:
End Sub

Cheeers Sige



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Speed up Code?

I think (hope) that you mean

you can try this at the beginning
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False

and this at the end

With Application
.Calculation = CalcMode
.ScreenUpdating = True


--
HTH

Bob Phillips

"Gary Keramidas" wrote in message
...
you can try this at the beginning
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False

and this at the end

With Application
CalcMode = .Calculation
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True


--


Gary


"Sige" wrote in message
oups.com...
Hi All,

In order to clean up some downloaded figures I run the following sub.
It works fine!!!

Sometimes I have the impression though that routine is calculating
rather slow.
It gets through but ...it takes
(sometimes looots of..)time.

Is there a way to speed up the routine???

Public Sub BlanksToNumbers()
Dim r As Range
Dim w As Worksheet
On Error GoTo err
Application.ScreenUpdating = False
For Each w In ActiveWorkbook.Worksheets
For Each r In w.UsedRange.Cells
r.Cells.Font.Name = "Arial"
If r.TEXT = "" And r.Formula = "" Then r.Value = ""
Next r
Next w
Application.ScreenUpdating = True
err:
End Sub

Cheeers Sige





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Speed up Code?

Hi Bob, Gary many thanks!

Gary: I'll take Bob's solution ;o)

"NOSPAM" to be removed for direct mailing...

*** Sent via Developersdex http://www.developersdex.com ***
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default Speed up Code?

use whichever one you want, just let us know if it works or not<g

--


Gary


"SIGE" wrote in message
...
Hi Bob, Gary many thanks!

Gary: I'll take Bob's solution ;o)

"NOSPAM" to be removed for direct mailing...

*** Sent via Developersdex http://www.developersdex.com ***



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to Speed Up A Code LostInNY Excel Worksheet Functions 2 July 20th 09 06:18 PM
Speed up code Derick Hughes Excel Programming 0 February 8th 05 04:18 PM
Code Speed Up lists[_2_] Excel Programming 3 August 10th 04 12:06 PM
Analyzing code speed mbobro[_2_] Excel Programming 1 November 3rd 03 10:05 PM


All times are GMT +1. The time now is 07:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"