percy4
04-28-2009, 04:29 AM
Hi,
I’ve got a problem with below code.
It just wont allow my querytables to refresh on my protected sheet even though I’ve enabled userinterfaceonly function when my workbook opens.
Thanks a bunch!
P.
Private Sub Workbook_Open()
Dim wSheet As Worksheet
For Each wSheet In Worksheets
wSheet.Protect Password:="", _
UserInterFaceOnly:=True
wSheet.EnableAutoFilter = True
Next wSheet
End Sub
Sub skarp()
‘ This macro is assigned to a button
Msgbox "Data will now be refreshed. It may take up to 1 minute."
Dim ws As Worksheet
Dim qt As QueryTable
For Each ws In ThisWorkbook.Worksheets
For Each qt In ws.QueryTables
qt.BackgroundQuery = False
qt.Refresh
Next qt
Next ws
DoEvents
Msgbox "Refresh completed"
End Sub
I’ve got a problem with below code.
It just wont allow my querytables to refresh on my protected sheet even though I’ve enabled userinterfaceonly function when my workbook opens.
Thanks a bunch!
P.
Private Sub Workbook_Open()
Dim wSheet As Worksheet
For Each wSheet In Worksheets
wSheet.Protect Password:="", _
UserInterFaceOnly:=True
wSheet.EnableAutoFilter = True
Next wSheet
End Sub
Sub skarp()
‘ This macro is assigned to a button
Msgbox "Data will now be refreshed. It may take up to 1 minute."
Dim ws As Worksheet
Dim qt As QueryTable
For Each ws In ThisWorkbook.Worksheets
For Each qt In ws.QueryTables
qt.BackgroundQuery = False
qt.Refresh
Next qt
Next ws
DoEvents
Msgbox "Refresh completed"
End Sub