Hello, I have been lurking here for a long time and have learned much from all of you. Thank you!!! I have something that I haven't been able to find an answer to, so I'm hoping one of you can help.
I have an estimate sheet where the mark up % fields ("G21,G26,H21,H26") are locked unless certain quote types are selected within the Quote Type drop down (cell D6 - Types: Change Estimate, Dealer, Non-Contract Estimate) and the VBA to lock and unlock it has worked great.
But I now need to add an additional scenario that unlocks these fields when the quote type = "Tender Estimate" AND the value of another field (L36) is greater than 24. Cell L36 is a formula that produces a value (percentage). This is what I tried:
The first 3 Quote types still work to unlock the mark up fields, but the new part is not. What am I doing wrong?
Thanks (very much!!) in advance.
I have an estimate sheet where the mark up % fields ("G21,G26,H21,H26") are locked unless certain quote types are selected within the Quote Type drop down (cell D6 - Types: Change Estimate, Dealer, Non-Contract Estimate) and the VBA to lock and unlock it has worked great.
But I now need to add an additional scenario that unlocks these fields when the quote type = "Tender Estimate" AND the value of another field (L36) is greater than 24. Cell L36 is a formula that produces a value (percentage). This is what I tried:
Code:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myPassword As String
myPassword = "xxxxxx"
Unprotect Password:=myPassword
If Range("D6").Text = "Change Estimate" Or Range("D6").Text = "Dealer" Or _
Range("D6").Text = "Non-Contract Estimate" Then
Range("G21,G26,H21,H26").Locked = False
ElseIf Range("D6").Text = "Tender Estimate" And Range("L36").Value >= 25 Then
Range("G21,G26,H21,H26").Locked = False
Else
Range("G21,G26,H21,H26").Locked = True
End If
Protect Password:=myPassword
End Sub
The first 3 Quote types still work to unlock the mark up fields, but the new part is not. What am I doing wrong?
Thanks (very much!!) in advance.