Protecting excel sheet for data input

  • Thread starter Thread starter rdrnws
  • Start date Start date
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
 
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
 
Back
Top