|
-
May 27th, 2005, 09:23 AM
#1
Thread Starter
Hyperactive Member
Excel sheet protection and VBA code
Does anyone know how to get Excel to allow VBA code to write to a password protected worksheet?
I am using a work-around solution at the moment whereby the VBA unprotects the relevant worksheet, writes data to it, then re-protects it.
There must be a better way than this though. Obviously I don't want my users to delete the formulas etc in the worksheet but I want my code to be able to write data to the worksheet without having to unprotect/re-protect it all the time!
Thanks
-Rob
http://www.sudsolutions.com
-
May 27th, 2005, 11:37 AM
#2
Re: Excel sheet protection and VBA code
I think the only way is to do as you are. You could possibly add a new sheet as the "Display" sheet and have it linked to your
actual sheet. I think the protected "Dsiplay" sheet will still update as you change the "hidden" sheet.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 28th, 2005, 02:58 PM
#3
Re: Excel sheet protection and VBA code
I used the method unprotect/protect in a excel-file, it works fine.
For each entry the code starts off with unprotecting and at the end it protects the file again. I had no problem with that.
Why don't you leave the cells that unprotected where user entries are allowed?
If your formulas are not in those cells, nothing can happen!
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|