Blocking cells for certain users

miguelg8

New Member
Joined
Oct 16, 2009
Messages
3
Is there any way to block editing cells or columns for certain users?
Let's say i want:
John to edit column A
Peter to edit Column B
Peter and John column C.

Is this possible? I don't know the information they are entering, so i can't restrict the content, but want to restrict the lines they can edit.

Thanks!
 

Some videos you may like

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

hatman

Well-known Member
Joined
Apr 8, 2005
Messages
2,664
Welcome to teh Board!!!

The only way I can think of to do this is to use VBA. In the Close event of the workbook, you would lock all cells on the worksheet, and protect the sheet. In the Open event of the workbook, you then use Environ("USERNAME") to determine the username of the person logged in, and unlock the appropriate cells based on the return value.
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
Hatman is correct in assuming you will need VBA. There are, however, several approaches, including his suggestion of using Environ("UserName"). This.however, is my approach
Code:
Private Sub Worksheet_Change(Byval Target as Range)
Select Case Target.Column
Case 1:
    If InputBox ("Enter password") <> "passwordA" Then
        MsgBox "Wrong password"
        Application.Enable.Events = False
        Application.Undo
        Application.EnableEvents = True
    End If
Case 2
   'similar code
'etc
Case Else:
End Select
End Sub
lenze
 

miguelg8

New Member
Joined
Oct 16, 2009
Messages
3
Thanks both!
I will try this during the weekend and let you know what my result is.

Regards
 

Watch MrExcel Video

Forum statistics

Threads
1,099,776
Messages
5,470,713
Members
406,718
Latest member
waseem11

This Week's Hot Topics

Top