dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,375
- Office Version
- 365
- 2016
- Platform
- Windows
I have a spreadsheet and part of the code contains the following :
The code is attached to a checkbox. There is a drop down box in E5 and if Activities is selected I need X5 to be a 1 regardless of if the checkbox is selected but if something other than Activities is selected, I want the checkbox (txtIncrease) to allow the control of X5. Meaning X5 needs to have a 1.1 and if it is selected or a 1 if it isn't selected.
Can someone help me with the vba code as I don't know much vba?
txtincrease is a checkbox. I know I should of called it chkIncrease but I didn't and now there is too many references to it to go and change it, both in vba and excel itself.
Thanks
Code:
Worksheets("home").Unprotect Password:="costings"
If txtIncrease.Value = True Then
If Worksheets("home").Range("E5").Value = "Activities" Then
Worksheets("home").Range("X5").Value = "1"
Else
Worksheets("home").Range("X5").Value = "1.1"
Else
Worksheets("home").Range("X5").Value = "1"
End If
End If
Worksheets("home").Protect Password:="costings"
The code is attached to a checkbox. There is a drop down box in E5 and if Activities is selected I need X5 to be a 1 regardless of if the checkbox is selected but if something other than Activities is selected, I want the checkbox (txtIncrease) to allow the control of X5. Meaning X5 needs to have a 1.1 and if it is selected or a 1 if it isn't selected.
Can someone help me with the vba code as I don't know much vba?
txtincrease is a checkbox. I know I should of called it chkIncrease but I didn't and now there is too many references to it to go and change it, both in vba and excel itself.
Thanks