ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loop in sheets (https://www.excelbanter.com/excel-programming/346726-loop-sheets.html)

al007

Loop in sheets
 
Sub RefreshCalculate()

Cells.Select
Selection.Replace What:="=", Replacement:="="
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
Calculate
End Sub

What additional code (&where) do I need to add to make above macro run
on all sheets in workbook i.e loop in all sheets
Thxs


access

Loop in sheets
 
This should do the trick.

Sub RefreshCalculate()
Dim MySheet as Worksheet

For Each MySheet In Worksheets
Cells.Select
Selection.Replace What:="=", Replacement:="="
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
Calculate

Next

End Sub

Regards, Martijn

"al007" schreef in bericht
oups.com...
Sub RefreshCalculate()

Cells.Select
Selection.Replace What:="=", Replacement:="="
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
Calculate
End Sub

What additional code (&where) do I need to add to make above macro run
on all sheets in workbook i.e loop in all sheets
Thxs




Bob Phillips[_6_]

Loop in sheets
 
Not quite

Sub RefreshCalculate()
Dim sh As Worksheet
ActiveWorkbook.PrecisionAsDisplayed = False
For Each sh In ActiveWorkbook.Worksheets
sh.Cells.Replace What:="=", Replacement:="="
Next sh
Application.MaxChange = 0.001
Calculate
End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"access" wrote in message
...
This should do the trick.

Sub RefreshCalculate()
Dim MySheet as Worksheet

For Each MySheet In Worksheets
Cells.Select
Selection.Replace What:="=", Replacement:="="
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
Calculate

Next

End Sub

Regards, Martijn

"al007" schreef in bericht
oups.com...
Sub RefreshCalculate()

Cells.Select
Selection.Replace What:="=", Replacement:="="
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
Calculate
End Sub

What additional code (&where) do I need to add to make above macro run
on all sheets in workbook i.e loop in all sheets
Thxs






Chip Pearson

Loop in sheets
 
You still need to Select the sheet.

For Each MySheet In Worksheets
MySheet.Select
Cells.Select
Selection.Replace What:="=", Replacement:="="
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
Calculate
Next


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"access" wrote in message
...
This should do the trick.

Sub RefreshCalculate()
Dim MySheet as Worksheet

For Each MySheet In Worksheets
Cells.Select
Selection.Replace What:="=", Replacement:="="
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
Calculate

Next

End Sub

Regards, Martijn

"al007" schreef in bericht
oups.com...
Sub RefreshCalculate()

Cells.Select
Selection.Replace What:="=", Replacement:="="
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
Calculate
End Sub

What additional code (&where) do I need to add to make above
macro run
on all sheets in workbook i.e loop in all sheets
Thxs






al007

Loop in sheets
 
thxs all for ur help


Chip Pearson wrote:
You still need to Select the sheet.

For Each MySheet In Worksheets
MySheet.Select
Cells.Select
Selection.Replace What:="=", Replacement:="="
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
Calculate
Next


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"access" wrote in message
...
This should do the trick.

Sub RefreshCalculate()
Dim MySheet as Worksheet

For Each MySheet In Worksheets
Cells.Select
Selection.Replace What:="=", Replacement:="="
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
Calculate

Next

End Sub

Regards, Martijn

"al007" schreef in bericht
oups.com...
Sub RefreshCalculate()

Cells.Select
Selection.Replace What:="=", Replacement:="="
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
Calculate
End Sub

What additional code (&where) do I need to add to make above
macro run
on all sheets in workbook i.e loop in all sheets
Thxs






All times are GMT +1. The time now is 06:54 AM.

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