Hi, I have an Excel worksheet form that had working VBA code behind it in a previous version of Excel, but does not work in Excel 2013. I have tried searching on the error but have not had any luck finding a solution yet. It really isn't very complicated at all either, I have one checkbox, that is used in a pair of Case statements run by whether or not the value of the checkbox, here is my code:
The error is focused around the 'ControlFormat' on the Checkboxes Value, error '1004" 'Unable to get the Value property of the Checkbox class'
Thank you
The error is focused around the 'ControlFormat' on the Checkboxes Value, error '1004" 'Unable to get the Value property of the Checkbox class'
Code:
Public Sub Worksheet_Change(ByVal Target As Range)
Dim Fee1, Fee2, Fee3, Fee4 As Double
Set Target = Range("F35")
If Not Intersect(Target, Range("F35")) Is Nothing Then
'**********************************
'IF FEES CHANGE - MODIFY THE FEE VARIABLES BELOW, ACCORDINGLY.
Fee1 = 40 'Fee for <= 60lbs.
Fee2 = 79 'Fee for > 60 and < 125lbs.
Fee3 = 118 'Fee for > 125 and < 187lbs.
Fee4 = 158 'Fee for > 187lbs.
'***********************************
'**********************************
'IF THE $40 MUNICIPAL ASSISTANCE BOX IS CHECKED, THESE ARE FEES APPLIED
'IF FEES CHANGE - MODIFY THE FEE VARIABLES BELOW, ACCORDINGLY.
Fee5 = 0 'Fee for <= 60lbs.
Fee6 = 39 'Fee for > 60 and < 125lbs.
Fee7 = 78 'Fee for > 125 and < 187lbs.
Fee8 = 118 'Fee for > 187lbs.
'***********************************
If ActiveSheet.Shapes("Check Box 3").ControlFormat.Value <> 1 Then
Select Case Target
Case 0 To 60
ActiveSheet.Range("F36").Value = Fee1
Case 60 To 125
ActiveSheet.Range("F36").Value = Fee2
Case 125 To 187
ActiveSheet.Range("F36").Value = Fee3
Case Is > 187
ActiveSheet.Range("F36").Value = Fee4
End Select
End If
If ActiveSheet.Shapes("Check Box 3").ControlFormat.Value = 1 Then
Select Case Target
Case 0 To 60
ActiveSheet.Range("F36").Value = Fee5
Case 60 To 125
ActiveSheet.Range("F36").Value = Fee6
Case 125 To 187
ActiveSheet.Range("F36").Value = Fee7
Case Is > 187
ActiveSheet.Range("F36").Value = Fee8
End Select
End If
End If
End Sub
Thank you