View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
peddie peddie is offline
external usenet poster
 
Posts: 4
Default VBA for Cell locked please help

Hi

I don't seem to get any error when opening the workbook however it
doesnt do the job. I want to allow certain users to be able to amend
the content in the Worksheet but if they are not the selected users
then they can only view the data. Could anyone please advice me what I
have to do.

Thank you very much in advance. below is my code

Peddie


Private Sub Workbook_Open()


Dim username As String

username = OSUserName()

'If username = "John Smith" Then

lock_cells

'Else
'Selection.Locked = True
End Sub


Sub lock_cells()
Sheets("Apr 2006 - Mar 2007").Select
Cells.Locked = True

End Sub