Hello everyone,
I want to block H16 and H20 when I'm on that sheet.
With a button I can insert the value, so it unlocks like that.
But once you can "edit" the page again. Those 2 cells have to be locked.
They also change when i'm in 3 other sheets. so the simple way is to just block them and change the protection of that sheet once the value changes in an other sheet.
But since this will take way too much time, I thought it might be possible to just lock them when you're on the sheet itself, since then it can't be changed from other sheets.
Example:
This is how I make sure the sheet is unlocked when I change values.
But since H16 and H20 will be changed in over 300 occasions It's a pain to put an unprotection and protection in every occassion.
So Basicly I want something like this, but then in VBA code
Activesheet = Sheet1
then Cells H16 and H20 Locked
Activesheet = Sheet 2 or anything else
then Cells H16 and H20 Unlocked
Is this possible?
Kind Regards,
I want to block H16 and H20 when I'm on that sheet.
With a button I can insert the value, so it unlocks like that.
But once you can "edit" the page again. Those 2 cells have to be locked.
They also change when i'm in 3 other sheets. so the simple way is to just block them and change the protection of that sheet once the value changes in an other sheet.
But since this will take way too much time, I thought it might be possible to just lock them when you're on the sheet itself, since then it can't be changed from other sheets.
Example:
Code:
Sub Test1()
Worksheets("Sheet1").Unprotect Password:="xxx"
Range("F8").value = ""
Range("F9").value = ""
name = InputBox("Enter Name")
Range("F8").value = name
a = 1
Range("H20").value = "=F9"
Worksheets("Sheet1").Protect Password:="xxx"
End Sub
This is how I make sure the sheet is unlocked when I change values.
But since H16 and H20 will be changed in over 300 occasions It's a pain to put an unprotection and protection in every occassion.
So Basicly I want something like this, but then in VBA code
Activesheet = Sheet1
then Cells H16 and H20 Locked
Activesheet = Sheet 2 or anything else
then Cells H16 and H20 Unlocked
Is this possible?
Kind Regards,