![]() |
protecting cells by password
you areHi! All Expert
Is it possible to protect five or six cell with a password. I mean to say if somebody edit or type in these cell excel ask for a password. I dont want excel will show the warning ( The cell or chart you are trying to change is protected and therefor read- only). I want to show only PASSWORD Option. Any help will be Appriciate Hope to hear your soon Thanks in Advance Hardeep kanwar |
protecting cells by password
You must use VBA for this. Copy the following macro and place it in the
sheet module of your sheet. To access that module, right-click on the sheet tab and select View Code. "X" out of the module to return to your sheet. I assumed that the range of cells was named "TheRng" and the password is "ThePassword". Change these in the code as needed. HTH Otto Private Sub Worksheet_Change(ByVal Target As Range) Dim TheEntry As Variant If Target.Count 1 Then Exit Sub If Not Intersect(Target, Range("TheRng")) Is Nothing Then Application.ScreenUpdating = False Application.EnableEvents = False TheEntry = Target.Value Application.Undo If InputBox("Please enter the password.") = "ThePassword" Then Target.Value = TheEntry End If Application.EnableEvents = True Application.ScreenUpdating = True End If End Sub "Hardeep_kanwar" wrote in message ... you areHi! All Expert Is it possible to protect five or six cell with a password. I mean to say if somebody edit or type in these cell excel ask for a password. I dont want excel will show the warning ( The cell or chart you are trying to change is protected and therefor read- only). I want to show only PASSWORD Option. Any help will be Appriciate Hope to hear your soon Thanks in Advance Hardeep kanwar |
protecting cells by password
Thanks Sir
It works Great hardeep kanwar "Otto Moehrbach" wrote: You must use VBA for this. Copy the following macro and place it in the sheet module of your sheet. To access that module, right-click on the sheet tab and select View Code. "X" out of the module to return to your sheet. I assumed that the range of cells was named "TheRng" and the password is "ThePassword". Change these in the code as needed. HTH Otto Private Sub Worksheet_Change(ByVal Target As Range) Dim TheEntry As Variant If Target.Count 1 Then Exit Sub If Not Intersect(Target, Range("TheRng")) Is Nothing Then Application.ScreenUpdating = False Application.EnableEvents = False TheEntry = Target.Value Application.Undo If InputBox("Please enter the password.") = "ThePassword" Then Target.Value = TheEntry End If Application.EnableEvents = True Application.ScreenUpdating = True End If End Sub "Hardeep_kanwar" wrote in message ... you areHi! All Expert Is it possible to protect five or six cell with a password. I mean to say if somebody edit or type in these cell excel ask for a password. I dont want excel will show the warning ( The cell or chart you are trying to change is protected and therefor read- only). I want to show only PASSWORD Option. Any help will be Appriciate Hope to hear your soon Thanks in Advance Hardeep kanwar |
All times are GMT +1. The time now is 08:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com