Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a spreadsheet (3 sheets) that helps people calculate time from a
time card (hours/days worked and alerts if too many or too few hours are worked.) On the form I have a checkbox that allows users to select if they want the sheet printed. I this box is selected it shows several boxes where data can be listed; employee name, dates, etc. Is there a way to lock/unlock these cells (as well as hide them) depending on the condition of the checkbox? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() You would have lock/unlock them from the vba. 1. In the sheet, select All 2. Right click the cells to be locked, select "Format Cells". 3. Select the "Protection" tab 4. Click the checkbox for "Locked" Now, from your code, you would need to input the following where you checkbox control is. Ex. Sub CheckBox1() If UserForm1.CheckBox1.Value = True Then Sheets("Sheet1").Protect ("password") Sheets("Sheet2").Protect ("password") 'continue with however many yo need Else: Sheets("Sheet1").Unprotect ("password") 'both passwords must be th same Sheets("Sheet2").Unprotect ("password") End If End Sub L Scholes Wrote: I have a spreadsheet (3 sheets) that helps people calculate time from a time card (hours/days worked and alerts if too many or too few hours are worked.) On the form I have a checkbox that allows users to select if they want the sheet printed. I this box is selected it show several boxes where data can be listed; employee name, dates, etc. Is there a way to lock/unlock these cells (as well as hide them) depending on the condition of the checkbox -- dok11 ----------------------------------------------------------------------- dok112's Profile: http://www.excelforum.com/member.php...fo&userid=1058 View this thread: http://www.excelforum.com/showthread.php?threadid=52984 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This seems to have the effect of locking and locking all cells selected
for locking. I just want to unlock certain cells so that when the user clicks the "Printable Version" check box it unlocks the blocks necessary to enter for printing (names, dates, etc.) but leaves all cells with code locked. Any ideas? dok112 wrote: You would have lock/unlock them from the vba. 1. In the sheet, select All 2. Right click the cells to be locked, select "Format Cells". 3. Select the "Protection" tab 4. Click the checkbox for "Locked" Now, from your code, you would need to input the following where your checkbox control is. Ex. Sub CheckBox1() If UserForm1.CheckBox1.Value = True Then Sheets("Sheet1").Protect ("password") Sheets("Sheet2").Protect ("password") 'continue with however many you need Else: Sheets("Sheet1").Unprotect ("password") 'both passwords must be the same Sheets("Sheet2").Unprotect ("password") End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Convert date from Gregorian Calendar to Hijri Calendar | Excel Discussion (Misc queries) | |||
find free sharware to include calendar pop or use calendar in cell | Excel Discussion (Misc queries) | |||
how do i export excel calendar info to outlook calendar? | Excel Discussion (Misc queries) | |||
excel calendar - list of names displayed on calendar | Excel Worksheet Functions | |||
import calendar items from excel into outlook calendar | Excel Discussion (Misc queries) |