tonywatsonhelp
Well-known Member
- Joined
- Feb 24, 2014
- Messages
- 3,210
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
Hi Everyone,
I have a sheet that is set up like a form,
I need people to fill the areas in one row at a time so I have a macro that locks the sheet which I run at the start.
then I have this macro that unlocks the rows in need as the correct data is added.
This all works great except if someone deletes it does not relock the cells heres the code I'll explain how it works after
So when you first open the sheet all cells except F15 are locked.
Column F are dropdown boxes and Columns G to L should unlock when F is filled in.
this works great, but hears my problem
lets say someone has filled in 4 rows so rows 15,16,17,18 are fully unlocked and 19 is Just F unlocked.
if you clear F18, the area does not relock itself. and that's what I need.
any ideas how I can do this?
Thanks
Tony
I have a sheet that is set up like a form,
I need people to fill the areas in one row at a time so I have a macro that locks the sheet which I run at the start.
then I have this macro that unlocks the rows in need as the correct data is added.
This all works great except if someone deletes it does not relock the cells heres the code I'll explain how it works after
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xRg As Range
On Error Resume Next
Set xRg = Intersect(Range("F15:F101"), Target)
If xRg Is Nothing Then Exit Sub
ActiveSheet.Unprotect Password:="august"
Cells(Target.Row, Target.Column + 1).Resize(1, 7).Locked = False
Cells(Target.Row + 1, Target.Column).Resize(1, 1).Locked = False
ActiveSheet.Protect Password:="august"
End Sub
So when you first open the sheet all cells except F15 are locked.
Column F are dropdown boxes and Columns G to L should unlock when F is filled in.
this works great, but hears my problem
lets say someone has filled in 4 rows so rows 15,16,17,18 are fully unlocked and 19 is Just F unlocked.
if you clear F18, the area does not relock itself. and that's what I need.
any ideas how I can do this?
Thanks
Tony