Hi -
I'm using this code to refresh a query data on a protected sheet . The problem is , the code starts refreshing the query, then re-protects the sheet before the data starts to load to the sheet, and then I sometimes get the warning "The cell...is on a protected sheet...." , and the so the Table doesn't update.
What do I need to add after to the connection refresh to make Excel wait until the data is loaded to the sheet before re-protecting it?
I'm using this code to refresh a query data on a protected sheet . The problem is , the code starts refreshing the query, then re-protects the sheet before the data starts to load to the sheet, and then I sometimes get the warning "The cell...is on a protected sheet...." , and the so the Table doesn't update.
VBA Code:
Sub Refresh_Report()
Sheets("Report").Unprotect Password:="123"
ActiveWorkbook.Connections("Query - Full Report").Refresh
Sheets("Report").Protect Password:="123"
End Sub
What do I need to add after to the connection refresh to make Excel wait until the data is loaded to the sheet before re-protecting it?