ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Refreshing External Data (https://www.excelbanter.com/excel-programming/402834-refreshing-external-data.html)

eggpap

Refreshing External Data
 
Hello,

the following macro performs only if I set one or more breakpoints in it.
If I run the macro without breakpoints I get one error that says the Data
refresment is impossible owing to the protection of some cells or graphs.
The external data are contained in the sheets A, B and C only.

Sub UpdateAll()
Sheets("A").Select
ActiveSheet.Unprotect
Sheets("B").Select
ActiveSheet.Unprotect
Sheets("C").Select
ActiveSheet.Unprotect
ActiveWorkbook.RefreshAll
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
Sheets("B").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
Sheets("A").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
End Sub

Emiliano



theSquirrel

Refreshing External Data
 
On Dec 16, 12:24 pm, "eggpap" wrote:
Hello,

the following macro performs only if I set one or more breakpoints in it.
If I run the macro without breakpoints I get one error that says the Data
refresment is impossible owing to the protection of some cells or graphs.
The external data are contained in the sheets A, B and C only.

Sub UpdateAll()
Sheets("A").Select
ActiveSheet.Unprotect
Sheets("B").Select
ActiveSheet.Unprotect
Sheets("C").Select
ActiveSheet.Unprotect
ActiveWorkbook.RefreshAll
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
Sheets("B").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
Sheets("A").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
End Sub

Emiliano


From the sounds of it, with the breakpoints you are allowing time for
the refresing of the External Data. With the speed at which your code
runs will be much faster than even the fastest net connection to find,
process and populate the cells you are updating. You need to find a
way to slow down your code...

theSquirrel


All times are GMT +1. The time now is 05:58 PM.

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