Protecting excel sheet for data input

R

rdrnws

Dear All:

I am using Excel for inputting data as part of a larger application. Each
worksheet roughly corresponds to a table for user input. Each table has a
predefined number of columns, the rest of the columns in the worksheet are
not being used and can be hidden from the user. My concern is about the data
area of the worksheet, which I am not protecting in any way because I want
the user to be able to modify the data at will. During this process, the
user may, for example, accidentally delete a useful table column. So I am
looking for a way to at least prevent column deletion while allowing data
input/editing functions. Also, the data area of the worksheet contains
defined names. How can I protect these from deletion as well?

TIA for all suggestions,

Nikolas

ps. I will be using VBA to implement protection of the data table
 
N

Nigel

A simple password protection applied to all sheets might be enough?

Sub protectsheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True,
Password:="Password"
Next
End Sub

Sub unprotectsheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Unprotect ("Password")
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top