Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Query, then Protect Spreadsheet
Hello,
I'm trying to populate cells from a query where some cells are locked and the cells I'm populating are unlocked. However, when I run my macro, I get an error message telling me I can't do anything w/o unprotecting the spreadsheet. The macro DOES run if I unprotect the spreadsheet. What can I do to keep users from modifying the form, but still be able to run the macro by clicking a button. FYI... the macro automatically locks unlocked cells after the query is done. I don't understand why this happens. --- Message posted from http://www.ExcelForum.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Query, then Protect Spreadsheet
If I understand what you are asking,
In excel; Protect the sheet with a a password. In VBA; unprotect the sheet using the password run the query protect the sheet again Hopes this helps, Boici -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Query, then Protect Spreadsheet
Thank you, but if I do that, then the code is executed soo fast that th
ss is protected again before the query can finish. So I tried th Sleep() method to give the query time to finish, but unfortunately i didn't help. I receive the same error -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Query, then Protect Spreadsheet
Don
I am having the same problem...I used your code, but when I try to "refresh data" it gives me the error that the sheet is protected and cannot refresh. Any ideas ----- Don wrote: ---- Don't know if you solved this,bu Sub Auto_Open( With ThisWorkbook.Sheets("SHeet1" .Protect UserInterfaceOnly:=Tru End Wit End Su Then your macros will be able to modify everything, but the users will not, and you won't need to unlock and relock the sheet Don |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Worksheet protect with query-based table | Excel Discussion (Misc queries) | |||
Import New Database Query (Union Query) in Spreadsheet | Excel Discussion (Misc queries) | |||
protect query from edit | Setting up and Configuration of Excel | |||
how to protect worksheet from edit my query | Excel Discussion (Misc queries) | |||
How to protect the query use for a Pivot that uses 'Get External D | Excel Discussion (Misc queries) |