Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
While sheet is protected, allow cmdButton to refresh query.
I have two sections on my sheet. One being a query and the next section for
users to input data. The query is protected and the later can be edited. However, I would like to allow users to click on an update button which I have programmed to update the queries from database. When the sheet is protected, users failed to click on the button eventhough I have uncheck the lock property. This is the code for the update button: Private Sub cmdButton_RefreshMDBF_Click() Range("MDBF_Query").QueryTable.Refresh BackgroundQuery:=False Range("Plan_MDBF_Query").QueryTable.Refresh BackgroundQuery:=False Range("MDBF_Plan").Calculate End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
While sheet is protected, allow cmdButton to refresh query.
Hi M,
Try: '=========== Private Sub cmdButton_RefreshMDBF_Click() Dim SH As Worksheet Set SH = Sheets("Sheet1") '<<==== CHANGE SH.Unprotrect Password:= "Your password" 'Your query code SH.Protrect Password:= "Your password" End Sub '<<=========== --- Regards, Norman "mhng" wrote in message ... I have two sections on my sheet. One being a query and the next section for users to input data. The query is protected and the later can be edited. However, I would like to allow users to click on an update button which I have programmed to update the queries from database. When the sheet is protected, users failed to click on the button eventhough I have uncheck the lock property. This is the code for the update button: Private Sub cmdButton_RefreshMDBF_Click() Range("MDBF_Query").QueryTable.Refresh BackgroundQuery:=False Range("Plan_MDBF_Query").QueryTable.Refresh BackgroundQuery:=False Range("MDBF_Plan").Calculate End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
While sheet is protected, allow cmdButton to refresh query.
Thanks. It worked!
"Norman Jones" wrote: Hi M, Try: '=========== Private Sub cmdButton_RefreshMDBF_Click() Dim SH As Worksheet Set SH = Sheets("Sheet1") '<<==== CHANGE SH.Unprotrect Password:= "Your password" 'Your query code SH.Protrect Password:= "Your password" End Sub '<<=========== --- Regards, Norman "mhng" wrote in message ... I have two sections on my sheet. One being a query and the next section for users to input data. The query is protected and the later can be edited. However, I would like to allow users to click on an update button which I have programmed to update the queries from database. When the sheet is protected, users failed to click on the button eventhough I have uncheck the lock property. This is the code for the update button: Private Sub cmdButton_RefreshMDBF_Click() Range("MDBF_Query").QueryTable.Refresh BackgroundQuery:=False Range("Plan_MDBF_Query").QueryTable.Refresh BackgroundQuery:=False Range("MDBF_Plan").Calculate End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Refresh Pivot table data in Protected sheet | Excel Discussion (Misc queries) | |||
Refresh pivot table on protected sheet | Excel Discussion (Misc queries) | |||
refresh external data on a protected sheet | Excel Discussion (Misc queries) | |||
Refresh Modified Query From Same Sheet | Excel Programming | |||
Refreshing an external query on a protected sheet | Excel Programming |