Excel worksheet, how to allow a data read and prevent user from editing the data

Have a simple spreadsheet that get's information from an iqy.  Want the data connection to update the spreadsheet, but users entering data would just be written over on next update, so no use.

How to prevent users from entering data but still allow data connection to write normally?

Double bonus points if users can still format cells, but not edit contents.
VirtualKansasAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Andrew VelascoOperational Account Management & Data AnalystCommented:
Hi,

Try Worksheet.Protect Method:
Worksheets("YourWorksheetName").Activate
Worksheet.Protect("YourPassword", Contents:=False)

***Code to Refresh Your Data Goes Here***

Worksheet.Protect("YourPassword",Contents:=True, AllowFormattingCells:=True, AllowFormattingColumns:=True, AllowFormattingRows:=True)

Open in new window


See http://msdn.microsoft.com/en-us/library/office/ff840611(v=office.15).aspx for more details.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Andrew VelascoOperational Account Management & Data AnalystCommented:
Oh forgot to mention.  For best effect, make sure you password protect your VBAProject as well (so they can't open VBA and see what the password is to unprotect the sheet.

I protect my VBA with passwords as a general habit - helps reduce the number of times I'm called on to fix things on my code after someone thought they would go in and "make it better" ;)
0
VirtualKansasAuthor Commented:
Hi Andrews and thank your for quick response.  Am going to take it on faith that this is the solution, since I haven't tested yet and frankly don;t know much about VBA (time to practice.)  Clearly your experienced and response was quick & thorough, including the addendum on protecting VBA (thank your for that.)  I'm on it...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.