ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Protection (https://www.excelbanter.com/excel-programming/356478-vba-protection.html)

Chris Watson[_4_]

VBA Protection
 

I have created a timesheet that has 2 command buttons, 1 transfers dat
to a data sheet and the other clears the timesheet, but when I pu
protect sheet the VBA button won't work, what am I doing wrong???

--
Chris Watso
-----------------------------------------------------------------------
Chris Watson's Profile: http://www.excelforum.com/member.php...nfo&userid=470
View this thread: http://www.excelforum.com/showthread.php?threadid=52425


funkymonkUK[_110_]

VBA Protection
 

in design mode select the buttons then right click go to format control
then click on the protection tab. untick the locked press ok and protec
the sheet.

I think the reason it is not working is becuase if it is locked and yo
protect it it protects the code that runs

--
funkymonkU
-----------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...fo&userid=1813
View this thread: http://www.excelforum.com/showthread.php?threadid=52425


broro183[_55_]

VBA Protection
 

Hi Chris,

I think that your problem is more likely to be caused by the fact tha
the sheet is protected (b/c depending on the tools - protect sheet
options chosen, it is probable that the time sheet can not be cleared
rather than the property of the command buttons.

Try entering the following line of code into the "this workbook" cod
module as part of a workbook open macro:

activesheet.Protect Password:="Password", UserInterfaceOnly:=True

(I've explained it a little i
http://excelforum.com/showthread.php?t=506721 & others have explaine
it too - try searching for (UserInterfaceOnly & protect). For othe
info, search "protect method" in VBE Help or by Googling.

hth
Rob Brockett
NZ
Always learning & the best way to learn is to experience..

--
broro18
-----------------------------------------------------------------------
broro183's Profile: http://www.excelforum.com/member.php...fo&userid=3006
View this thread: http://www.excelforum.com/showthread.php?threadid=52425


David C

VBA Protection
 
Or [which is simpler, and I found works well], 'Share' the workbook [ie
Tools, Share Workbook, tick the box] the save and make it Read only.

Sharing protects your macro and VB from sight/editing, and write protect
stops others turning off sharing.

"broro183" wrote:


Hi Chris,

I think that your problem is more likely to be caused by the fact that
the sheet is protected (b/c depending on the tools - protect sheet"
options chosen, it is probable that the time sheet can not be cleared)
rather than the property of the command buttons.

Try entering the following line of code into the "this workbook" code
module as part of a workbook open macro:

activesheet.Protect Password:="Password", UserInterfaceOnly:=True

(I've explained it a little in
http://excelforum.com/showthread.php?t=506721 & others have explained
it too - try searching for (UserInterfaceOnly & protect). For other
info, search "protect method" in VBE Help or by Googling.

hth
Rob Brockett
NZ
Always learning & the best way to learn is to experience...


--
broro183
------------------------------------------------------------------------
broro183's Profile: http://www.excelforum.com/member.php...o&userid=30068
View this thread: http://www.excelforum.com/showthread...hreadid=524255




All times are GMT +1. The time now is 11:29 PM.

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