Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default disallow edit in used rows on save

Hello,
I'm trying to prevent users from changing data once it is
entered and saved. It's a document they will add to
repeatedly. Number of rows used each session is
variable. If a row is used and needs to disallow future
editing, there will be text in colA.

Sub protectinput()
Dim myRng As Range

With ActiveSheet
Set myRng = .Range("A:A")
If CellType = "Text" Then
????????

Don't know where to go from there. Since data does need
to be added, it doesn't make sense to protect the sheet.
or does it?? Maybe protect the whole sheet on save, then
on open unlock range defined as blank cell in colA? Not
sure how to do that either, although, willing to try if
any of you pros out there think it's workable.

Thanks in advance!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default disallow edit in used rows on save

Erin,

This solution assumes you want to protect "Sheet1".

Select all the cells on Sheet1, then format them "unlocked" (uncheck
"locked" on the protection tab), and then protect the sheet without a
password.

Copy the code below, go into the VBE, and paste the code into the
Thisworkbook object's code module.

The code will protect the cells of all rows that have values (not formulas)
entered in column A.

You can modify the code to use a password if you fear that a user might edit
something incorrectly, but you can't reliably hide the password from users,
since it would need to be used in the code. Protecting the code will help,
but isn't foolproof.

HTH,
Bernie
MS Excel MVP

Private Sub Workbook_BeforeSave( _
ByVal SaveAsUI As Boolean, Cancel As Boolean)
Worksheets("Sheet1").Unprotect
Worksheets("Sheet1").Range("A:A").SpecialCells(xlC ellTypeConstants). _
EntireRow.Locked = True
Worksheets("Sheet1").Protect
End Sub



"erin" wrote in message
...
Hello,
I'm trying to prevent users from changing data once it is
entered and saved. It's a document they will add to
repeatedly. Number of rows used each session is
variable. If a row is used and needs to disallow future
editing, there will be text in colA.

Sub protectinput()
Dim myRng As Range

With ActiveSheet
Set myRng = .Range("A:A")
If CellType = "Text" Then
????????

Don't know where to go from there. Since data does need
to be added, it doesn't make sense to protect the sheet.
or does it?? Maybe protect the whole sheet on save, then
on open unlock range defined as blank cell in colA? Not
sure how to do that either, although, willing to try if
any of you pros out there think it's workable.

Thanks in advance!



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
Disallow File Save if No Input in Cells? Dan Raab Excel Discussion (Misc queries) 2 January 9th 06 06:37 PM
Disallow "SAVE" only "SAVE AS" or prompt DTTODGG Setting up and Configuration of Excel 6 December 21st 05 03:54 PM
cannot edit and save jp New Users to Excel 1 February 9th 05 03:25 AM
cannot edit and save jp Excel Discussion (Misc queries) 1 February 8th 05 05:12 PM
cannot edit and save jp Excel Discussion (Misc queries) 0 February 8th 05 03:27 AM


All times are GMT +1. The time now is 07:50 AM.

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"