Previous code not working in Excel 2013

akomarek

New Member
Joined
Aug 17, 2016
Messages
1
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'

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
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,223,176
Messages
6,170,542
Members
452,336
Latest member
boekl007

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