ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   protect with password (https://www.excelbanter.com/excel-programming/334317-protect-password.html)

nowfal[_8_]

protect with password
 

hi,
the following code starts with unprote the sheet and end with protected
sheet, now the problem is anybody can unprotect the sheet and do
something in the sheet . to avoid that i wanted to protect the sheet
with my own password say 'nowfal'. Is it possible to do that . if so
please help me in this matter .


Sub FCY2()
'
' FCY2 Macro
' Macro recorded 15/07/2004 by Musandam
'

'
ActiveSheet.Unprotect
Sheets("BILL").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Sheets("RECORD").Select
Range("A2:AH12000").Select
Selection.Copy
Range("A3").Select
ActiveSheet.PasteSpecial Format:=3, Link:=1, DisplayAsIcon:=False,
_
IconFileName:=False
Range("C2:H2").Select
Selection.ClearContents
Range("J2:L2").Select
Selection.ClearContents
Range("N2").Select
Selection.ClearContents
ActiveWindow.SmallScroll ToRight:=6
Range("O2:R2").Select
Selection.ClearContents
Range("T2:W2").Select
Selection.ClearContents
Range("Y2:AB2").Select
Selection.ClearContents
Range("AD2:AG2").Select
Selection.ClearContents
ActiveWindow.ScrollColumn = 1
Range("D2").Select
ActiveSheet.Protect DrawingObjects:=True, Scenarios:=True
ActiveWorkbook.Save
End Sub


--
nowfal
------------------------------------------------------------------------
nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003
View this thread: http://www.excelforum.com/showthread...hreadid=386565


Losse[_10_]

protect with password
 

Sub ProtectSheet()
Dim Password
Password = "nowfal"
ActiveSheet.Protect Password, True, True, True
End Sub
Sub UnProtectSheet()
Password = "nowfal"
ActiveSheet.Unprotect Password
End Sub


--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386565


nowfal[_9_]

protect with password
 

HI,
Sorry its not working, i repeat and shorten the code

ActiveSheet.Unprotect

ActiveSheet.Protect DrawingObjects:=True, Scenarios:=True
ActiveWorkbook.Save
End Sub

that unprotect with password say 'nowal'
at the end protect with same password.
eagerly waiting for the solution.
thanks in advance
with
regards
nowfa

--
nowfa
-----------------------------------------------------------------------
nowfal's Profile: http://www.excelforum.com/member.php...fo&userid=1000
View this thread: http://www.excelforum.com/showthread.php?threadid=38656


dominicb[_60_]

protect with password
 

Good evening Nowfal

Change this line:

ActiveSheet.Protect DrawingObjects:=True, Scenarios:=True

to this:

ActiveSheet.Protect DrawingObjects:=True, Scenarios:=True,
Password:="nowfal"

Is that any better?

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=386565


nowfal[_10_]

protect with password
 

Hi,
Mr.Dominic , sorry that is not working any other solution?, earlie
Late Mr.Frank kablin had given some idea , but i couldn't follow up
after sometime that great man left the world by tragic accident. Stil
i remember his contribution to this forum.
May God bless him.
regards
nowfa

--
nowfa
-----------------------------------------------------------------------
nowfal's Profile: http://www.excelforum.com/member.php...fo&userid=1000
View this thread: http://www.excelforum.com/showthread.php?threadid=38656


dominicb[_61_]

protect with password
 

Hi Nowfal

It does work. Copy this code in its entirity into a moduleof a blan
workbook. Run it, and then try to unprotect the sheet (Tools
Protection Unprotect Sheet. You will be prompted for a password
the password is "nowfal", without the quotes.

Sub ProtectSheet()
ActiveSheet.Protect DrawingObjects:=True, Scenarios:=True
Password:="nowfal"
End Sub

HTH

Dominic

--
dominic
-----------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893
View this thread: http://www.excelforum.com/showthread.php?threadid=38656


nowfal[_14_]

protect with password
 

hi ,
sorry to say its not working.
Still i am short of my requirement. when i am firing the macro i am
getting the unprotect box , which i am not expecting , my intention is
no other user can unprotect the sheet without my permission, and in the
mean while they and myself can able to do the normal job.
with regards
nowfal


--
nowfal
------------------------------------------------------------------------
nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003
View this thread: http://www.excelforum.com/showthread...hreadid=386565



All times are GMT +1. The time now is 04:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com