Excell-ent
New Member
- Joined
- Jan 13, 2014
- Messages
- 1
Hello!
I am completely new to VBA, however am trying to learn as much as possible and could really do with some help here!
I am having trouble with my VBA code, it hides groups of rows (projects) based on the contents of corresponding cells above. these have either 'yes' or 'no' in them (indicating if the person is active in that project). The Yes/No is formula based from another sheet.
what I am trying to do, is have particular cells, withing the projects rows, locked (as they are also populated by formulas) but have other cells open for editing.
when I try and do this i get an error with my VBA, i am assuming that as cells are locked, the VBA is prohibited form hiding inactive projects/rows.
i tried an addition at the bottom but this hasn't worked
I am completely new to VBA, however am trying to learn as much as possible and could really do with some help here!
I am having trouble with my VBA code, it hides groups of rows (projects) based on the contents of corresponding cells above. these have either 'yes' or 'no' in them (indicating if the person is active in that project). The Yes/No is formula based from another sheet.
what I am trying to do, is have particular cells, withing the projects rows, locked (as they are also populated by formulas) but have other cells open for editing.
when I try and do this i get an error with my VBA, i am assuming that as cells are locked, the VBA is prohibited form hiding inactive projects/rows.
i tried an addition at the bottom but this hasn't worked
Code:
Sub Worksheet_Calculate()
Dim i As Long, StartRow As Long, EndRow As Long
StartRow = 13
EndRow = 29
For i = 6 To 11
If UCase(Range("C" & i).Value) = "NO" Then
Rows(StartRow & ":" & EndRow).EntireRow.Hidden = True
Else
Rows(StartRow & ":" & EndRow).EntireRow.Hidden = False
End If
StartRow = StartRow + 18
EndRow = EndRow + 18
Next i
End Sub
Private Sub Workbook_Open()
Sheets("Sheet1").Protect Password:="password", UserInterFaceOnly:=True
End Sub