Set and Lock Value in Cell based on user selected input in Data Validation List

sonofasailor

New Member
Joined
Aug 13, 2012
Messages
1
Hello!

I am trying to set and lock the values in two cells when the user selects a particular value from a drop down list in another cell.

Each of the cells have data validation lists as well and they are all different.

Here is what I currently have but it errors on setting the value on H29. The error message i receive is Method 'Value' of object 'Range' failed.

I truly appreciate any help that can be offered!

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If [H28] = "-" Then
ActiveSheet.Unprotect
[H29].Value = "N"
[H30].Value = "-"
[H29].Locked = True
[H30].Locked = True
ActiveSheet.Protect
Else
ActiveSheet.Unprotect
[H29].Locked = False
[H30].Locked = False
ActiveSheet.Protect
End If
End Sub
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,215,432
Messages
6,124,860
Members
449,194
Latest member
HellScout

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top