Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 437
  • Last Modified:

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.
0
VirtualKansas
Asked:
VirtualKansas
  • 2
2 Solutions
 
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
 
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now