Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following code which of course based on a checkboxthe person
selects unprotects the worksheet, unhides the specified range of rows and then reprotects the workbook. As well if they un-check that checkbox it will rehide those rows. I am creating this for a group of employees. Here is my code: ------------------------------------------------------ Private Sub CheckBox1_Click() 'More then 1000 pr year If CheckBox1 = True Then Worksheets("Estimate").Unprotect "ds789" Range(Rows(118), Rows(142)).EntireRow.Hidden = False ElseIf CheckBox1 = False Then Range(Rows(68), Rows(142)).EntireRow.Hidden = True Worksheets("Estimate").Protect "ds789" End If End Sub Private Sub CheckBox2_Click() 'For Lots 25 to 1000 pr year If CheckBox2 = True Then Worksheets("Estimate").Unprotect "ds789" Range(Rows(92), Rows(117)).EntireRow.Hidden = False ElseIf CheckBox2 = False Then Range(Rows(68), Rows(141)).EntireRow.Hidden = True Worksheets("Estimate").Protect "ds789" End If End Sub Private Sub CheckBox3_Click() 'For Lots 1 to 25 pr year If CheckBox3 = True Then Worksheets("Estimate").Unprotect "ds789" Range(Rows(66), Rows(92)).EntireRow.Hidden = False ElseIf CheckBox3 = False Then Range(Rows(68), Rows(141)).EntireRow.Hidden = True Worksheets("Estimate").Protect "ds789" End If End Sub -------------------------------------------------- So now what I need to do is specify in there to only allow certain cells in those rows to be filled in. For example if they check checkbox1 then I need to unhide the rows specified but then only allow entry in the range c71:c77. I am thinking there has to be a way to do but I only know certain areas of visual basic programming code and its been as I go I learn. I would greatly appreciate anyone's assistance with this. ~M |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think you have to unprotect the sheet, unlock the range of cells desired
Range().Locked = False and reprotect the sheet. (Then vice-versa to relock the cells.) "MiComputerGeek78" wrote: I have the following code which of course based on a checkboxthe person selects unprotects the worksheet, unhides the specified range of rows and then reprotects the workbook. As well if they un-check that checkbox it will rehide those rows. I am creating this for a group of employees. Here is my code: ------------------------------------------------------ Private Sub CheckBox1_Click() 'More then 1000 pr year If CheckBox1 = True Then Worksheets("Estimate").Unprotect "ds789" Range(Rows(118), Rows(142)).EntireRow.Hidden = False ElseIf CheckBox1 = False Then Range(Rows(68), Rows(142)).EntireRow.Hidden = True Worksheets("Estimate").Protect "ds789" End If End Sub Private Sub CheckBox2_Click() 'For Lots 25 to 1000 pr year If CheckBox2 = True Then Worksheets("Estimate").Unprotect "ds789" Range(Rows(92), Rows(117)).EntireRow.Hidden = False ElseIf CheckBox2 = False Then Range(Rows(68), Rows(141)).EntireRow.Hidden = True Worksheets("Estimate").Protect "ds789" End If End Sub Private Sub CheckBox3_Click() 'For Lots 1 to 25 pr year If CheckBox3 = True Then Worksheets("Estimate").Unprotect "ds789" Range(Rows(66), Rows(92)).EntireRow.Hidden = False ElseIf CheckBox3 = False Then Range(Rows(68), Rows(141)).EntireRow.Hidden = True Worksheets("Estimate").Protect "ds789" End If End Sub -------------------------------------------------- So now what I need to do is specify in there to only allow certain cells in those rows to be filled in. For example if they check checkbox1 then I need to unhide the rows specified but then only allow entry in the range c71:c77. I am thinking there has to be a way to do but I only know certain areas of visual basic programming code and its been as I go I learn. I would greatly appreciate anyone's assistance with this. ~M |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Unhide, Unprotect, Enter Password | Excel Worksheet Functions | |||
Unhide column if range of cells contain data | Excel Worksheet Functions | |||
Creating Macro to Unprotect and unhide | Excel Discussion (Misc queries) | |||
I need a macro that runs other macros until P5=28 | Excel Discussion (Misc queries) | |||
Unprotect a range of cells in a protected worksheet | Excel Discussion (Misc queries) |