ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Increase Speed (https://www.excelbanter.com/excel-programming/328737-increase-speed.html)

[email protected]

Increase Speed
 
Hi There,

Normally underneath macro runs quite smoothly.
But sometimes this macro takes ages to complete...not that it bugs but
the calculation speed is like litterally 100 times slower. (for the
same range-sizes!)
All I can do is Close Excel and restart the marco ... to let it run at
normal speed.
Any Ideas? -For Improvement?

Option Explicit

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

Cheers, Sige


Don Guillett[_4_]

Increase Speed
 
this should change the font for the entire workbook which should be better
than changing part of each worksheet.

Sub changefontinworkbook()
Sheets.Select
Sheets(1).Activate
Cells.Select
With Selection.Font
.Name = "arial"
End With
Range("A1").Select
Sheets(1).Select
End Sub

--
Don Guillett
SalesAid Software

wrote in message
oups.com...
Hi There,

Normally underneath macro runs quite smoothly.
But sometimes this macro takes ages to complete...not that it bugs but
the calculation speed is like litterally 100 times slower. (for the
same range-sizes!)
All I can do is Close Excel and restart the marco ... to let it run at
normal speed.
Any Ideas? -For Improvement?

Option Explicit

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

Cheers, Sige




Don Guillett[_4_]

Increase Speed
 
or
Sub chgfontname()
Sheets.Select
Cells.Select
Selection.Font.Name = "arial"
Range("a1").Select
Sheets(1).Select
End Sub

--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
this should change the font for the entire workbook which should be better
than changing part of each worksheet.

Sub changefontinworkbook()
Sheets.Select
Sheets(1).Activate
Cells.Select
With Selection.Font
.Name = "arial"
End With
Range("A1").Select
Sheets(1).Select
End Sub

--
Don Guillett
SalesAid Software

wrote in message
oups.com...
Hi There,

Normally underneath macro runs quite smoothly.
But sometimes this macro takes ages to complete...not that it bugs but
the calculation speed is like litterally 100 times slower. (for the
same range-sizes!)
All I can do is Close Excel and restart the marco ... to let it run at
normal speed.
Any Ideas? -For Improvement?

Option Explicit

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

Cheers, Sige






Jef Gorbach

Increase Speed
 
or for speed, skip the selecting:

sub chgfontname()
sheets(1).font.name="arial"
end sub

"Don Guillett" wrote in message
...
or
Sub chgfontname()
Sheets.Select
Cells.Select
Selection.Font.Name = "arial"
Range("a1").Select
Sheets(1).Select
End Sub

--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
this should change the font for the entire workbook which should be

better
than changing part of each worksheet.

Sub changefontinworkbook()
Sheets.Select
Sheets(1).Activate
Cells.Select
With Selection.Font
.Name = "arial"
End With
Range("A1").Select
Sheets(1).Select
End Sub

--
Don Guillett
SalesAid Software

wrote in message
oups.com...
Hi There,

Normally underneath macro runs quite smoothly.
But sometimes this macro takes ages to complete...not that it bugs but
the calculation speed is like litterally 100 times slower. (for the
same range-sizes!)
All I can do is Close Excel and restart the marco ... to let it run at
normal speed.
Any Ideas? -For Improvement?

Option Explicit

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

Cheers, Sige








Don Guillett[_4_]

Increase Speed
 
and for the rest of the sheets?

--
Don Guillett
SalesAid Software

"Jef Gorbach" wrote in message
...
or for speed, skip the selecting:

sub chgfontname()
sheets(1).font.name="arial"
end sub

"Don Guillett" wrote in message
...
or
Sub chgfontname()
Sheets.Select
Cells.Select
Selection.Font.Name = "arial"
Range("a1").Select
Sheets(1).Select
End Sub

--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
this should change the font for the entire workbook which should be

better
than changing part of each worksheet.

Sub changefontinworkbook()
Sheets.Select
Sheets(1).Activate
Cells.Select
With Selection.Font
.Name = "arial"
End With
Range("A1").Select
Sheets(1).Select
End Sub

--
Don Guillett
SalesAid Software

wrote in message
oups.com...
Hi There,

Normally underneath macro runs quite smoothly.
But sometimes this macro takes ages to complete...not that it bugs

but
the calculation speed is like litterally 100 times slower. (for the
same range-sizes!)
All I can do is Close Excel and restart the marco ... to let it run

at
normal speed.
Any Ideas? -For Improvement?

Option Explicit

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

Cheers, Sige











All times are GMT +1. The time now is 09:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com