Dim ws As Worksheet Const pass As String = "rash" Dim ArChkBox(1 To 6) As Object
Private Sub UserForm_Activate() Set ArChkBox(1) = CheckBox1 Set ArChkBox(2) = CheckBox2 Set ArChkBox(3) = CheckBox3 Set ArChkBox(4) = CheckBox4 Set ArChkBox(5) = CheckBox5 Set ArChkBox(6) = CheckBox6 End Sub Private Sub Locked_Unlocked(Rowval As Long) Dim r As Long r = Rowval * 10 - 9 Sheet1.Unprotect pass Sheet1.Cells.Locked = True If ArChkBox(Rowval) Then Cells(r, 1).Resize(10, 1).EntireRow.Locked = False Else Cells(r, 1).Resize(10, 1).EntireRow.Locked = True End If Sheet1.Protect pass If Rowval > 1 Then ActiveWindow.ScrollRow = r - 2 Else: ActiveWindow.ScrollRow = r Cells(r, 1).Resize(10, 1).EntireRow.Select End Sub Private Sub CheckBox1_Click() Call Locked_Unlocked(1) End Sub Private Sub CheckBox2_Click() Call Locked_Unlocked(2) End Sub Private Sub CheckBox3_Click() Call Locked_Unlocked(3) End Sub Private Sub CheckBox4_Click() Call Locked_Unlocked(4) End Sub Private Sub CheckBox5_Click() Call Locked_Unlocked(5) End Sub Private Sub CheckBox6_Click() Call Locked_Unlocked(6) End Sub On Wed, Jun 29, 2011 at 1:53 PM, Rash <rashmiv.ni...@gmail.com> wrote: > Hi all, > > Need Help... > > I have a user form in which i have 6 check boxes. ok and cancel button. > > when ever I click 1st check box, rows 1 to 10 should to be editable, rest > all rows should be non editable and hidden. > > For check box 2, rows 11 to 20 editable, rest up and down area should be > non editable and hidden. And vice versa for other check boxes. > > I need a macro for this. Attached is the excel sheet with user form created > in background. > > Thanks in advance, > Rsh > > -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel
ctv_Test_Cells_Locking_Unlocking.xlsm
Description: Binary data