Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Only allow users to enter new data

I have an excel 2003 sheet on network drive.
Users at the moment enter data. but at the same time then can delete update
etc all other rows.
I only want them to be able to enter new rows/data. But do not want them to
update/delete/change etc on the data that already exists.
Any help with code/macro will be appreciated.
Thanks.

Murad
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Only allow users to enter new data

Murad,

Well, you could format all the blank cells to be unlocked, then protect the sheet (allowing the user
to select unlocked cells only, but with no password) and use event code like this:

Private Sub Worksheet_Change(ByVal Target As Range)
Me.Unprotect
Target.Locked = True
Me.Protect
End Sub

Copy the code, right-click the sheet tab, select "View Code" and paste the code in the window that
appears.

Note that once the user enters something, they will not be able to edit it.

Alternatively, you could lock cells with entries when the file is saved: put code like this into the
codemodule of the Thisworkbook object:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
With Worksheets("Sheet1")
.Unprotect
.Cells.Locked = False
.Cells.SpecialCells(xlCellTypeConstants).Locked = True
.Protect
End With
End Sub

HTH,
Bernie
MS Excel MVP


"Murad Sheikh" wrote in message
...
I have an excel 2003 sheet on network drive.
Users at the moment enter data. but at the same time then can delete update
etc all other rows.
I only want them to be able to enter new rows/data. But do not want them to
update/delete/change etc on the data that already exists.
Any help with code/macro will be appreciated.
Thanks.

Murad



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Only allow users to enter new data

Thanks Bernie,
It sounds good; I will have a go and let you know.
Thanks for the quick response.
Murad

"Bernie Deitrick" wrote:

Murad,

Well, you could format all the blank cells to be unlocked, then protect the sheet (allowing the user
to select unlocked cells only, but with no password) and use event code like this:

Private Sub Worksheet_Change(ByVal Target As Range)
Me.Unprotect
Target.Locked = True
Me.Protect
End Sub

Copy the code, right-click the sheet tab, select "View Code" and paste the code in the window that
appears.

Note that once the user enters something, they will not be able to edit it.

Alternatively, you could lock cells with entries when the file is saved: put code like this into the
codemodule of the Thisworkbook object:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
With Worksheets("Sheet1")
.Unprotect
.Cells.Locked = False
.Cells.SpecialCells(xlCellTypeConstants).Locked = True
.Protect
End With
End Sub

HTH,
Bernie
MS Excel MVP


"Murad Sheikh" wrote in message
...
I have an excel 2003 sheet on network drive.
Users at the moment enter data. but at the same time then can delete update
etc all other rows.
I only want them to be able to enter new rows/data. But do not want them to
update/delete/change etc on the data that already exists.
Any help with code/macro will be appreciated.
Thanks.

Murad




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
users must enter value = or than a certain value springtimetigger Excel Worksheet Functions 3 October 31st 08 05:28 PM
how do i force users to first enter data in one cell before anythi des-sa[_2_] Excel Discussion (Misc queries) 2 June 3rd 08 10:29 PM
Protect cells from other users w/out me having to enter pw Tara at Walsh Excel Discussion (Misc queries) 4 May 14th 07 10:40 PM
Defining specific areas for users to enter data Holt88 Excel Discussion (Misc queries) 6 February 17th 06 07:16 PM
Not allowing users to enter data into certain cells if another cell is empty KimberlyC Excel Programming 12 May 6th 05 06:19 PM


All times are GMT +1. The time now is 06:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"