Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 158
Default Protect After Saved

Dear experts,

I've a worksheet where a range A5:D100 is for some users to fill in
information. Is there a way when the cell is blank, it can be input by any
users. However, whenver an user fill in some information to some rows within
the range, the non-blank cells will be protected by a password, say "tiptoe"
after saved but other blank cells will still be unprotected and can be input
by other users. Is there a VBA code can do this? If yes, please kindly advise
the code.

Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Protect After Saved

Select A5:D100 and set properties to "unlocked". All other cells set to
"locked"

Right-click on the sheet tab and "View Code". Copy/paste this into the module
that opens up.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A5:D100")) Is Nothing Then
ActiveSheet.Unprotect Password:="tiptoe"
If Target.Value < "" Then
Target.Locked = True
End If
End If
enditall:
Application.EnableEvents = True
ActiveSheet.Protect Password:="tiptoe"
End Sub

Alt + q to return to the Excel sheet.

As you enter data in A5:D100 the cells will become locked.


Gord Dibben MS Excel MVP

On Thu, 19 Jun 2008 23:06:01 -0700, Freshman
wrote:

Dear experts,

I've a worksheet where a range A5:D100 is for some users to fill in
information. Is there a way when the cell is blank, it can be input by any
users. However, whenver an user fill in some information to some rows within
the range, the non-blank cells will be protected by a password, say "tiptoe"
after saved but other blank cells will still be unprotected and can be input
by other users. Is there a VBA code can do this? If yes, please kindly advise
the code.

Thanks in advance.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 158
Default Protect After Saved

Dear Gord,

Thanks for your time to write me the code. I'm really appreciated it. Have a
nice weekend.

Best regard to you and your family.

"Gord Dibben" wrote:

Select A5:D100 and set properties to "unlocked". All other cells set to
"locked"

Right-click on the sheet tab and "View Code". Copy/paste this into the module
that opens up.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A5:D100")) Is Nothing Then
ActiveSheet.Unprotect Password:="tiptoe"
If Target.Value < "" Then
Target.Locked = True
End If
End If
enditall:
Application.EnableEvents = True
ActiveSheet.Protect Password:="tiptoe"
End Sub

Alt + q to return to the Excel sheet.

As you enter data in A5:D100 the cells will become locked.


Gord Dibben MS Excel MVP

On Thu, 19 Jun 2008 23:06:01 -0700, Freshman
wrote:

Dear experts,

I've a worksheet where a range A5:D100 is for some users to fill in
information. Is there a way when the cell is blank, it can be input by any
users. However, whenver an user fill in some information to some rows within
the range, the non-blank cells will be protected by a password, say "tiptoe"
after saved but other blank cells will still be unprotected and can be input
by other users. Is there a VBA code can do this? If yes, please kindly advise
the code.

Thanks in advance.



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Protect After Saved

Thanks for the feedback and we will have a nice weekend.


Gord

On Sat, 21 Jun 2008 06:05:00 -0700, Freshman
wrote:

Dear Gord,

Thanks for your time to write me the code. I'm really appreciated it. Have a
nice weekend.

Best regard to you and your family.

"Gord Dibben" wrote:

Select A5:D100 and set properties to "unlocked". All other cells set to
"locked"

Right-click on the sheet tab and "View Code". Copy/paste this into the module
that opens up.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A5:D100")) Is Nothing Then
ActiveSheet.Unprotect Password:="tiptoe"
If Target.Value < "" Then
Target.Locked = True
End If
End If
enditall:
Application.EnableEvents = True
ActiveSheet.Protect Password:="tiptoe"
End Sub

Alt + q to return to the Excel sheet.

As you enter data in A5:D100 the cells will become locked.


Gord Dibben MS Excel MVP

On Thu, 19 Jun 2008 23:06:01 -0700, Freshman
wrote:

Dear experts,

I've a worksheet where a range A5:D100 is for some users to fill in
information. Is there a way when the cell is blank, it can be input by any
users. However, whenver an user fill in some information to some rows within
the range, the non-blank cells will be protected by a password, say "tiptoe"
after saved but other blank cells will still be unprotected and can be input
by other users. Is there a VBA code can do this? If yes, please kindly advise
the code.

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
Protect spreadsheet from being saved Otto Excel Discussion (Misc queries) 2 March 1st 07 08:41 PM
Protect Workbook Vs Protect Sheet Poor_pakistani New Users to Excel 4 May 25th 06 02:06 PM
Password Protect When Saved Nick Excel Discussion (Misc queries) 2 July 6th 05 07:29 PM
How can I see a copy of a saved workbook before I saved it again? Norma Excel Worksheet Functions 2 May 11th 05 10:31 AM
How to get saved old saved work that was saved over? Maral Excel Discussion (Misc queries) 1 February 20th 05 08:59 PM


All times are GMT +1. The time now is 12:21 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"