What is wrong?

Jonasraf

New Member
Joined
Jun 19, 2007
Messages
40
Sub CheckBox1_Click()

If CheckBox1.Value = True Then
Application.ScreenUpdating = False
Worksheets("Data").Range("b37").Select
ActiveCell.Value = -14
Worksheets("WogB").Select
Range("b34").Select
Application.ScreenUpdating = True
End If



If CheckBox1.Value = False Then
Application.ScreenUpdating = False
Worksheets("Data").Select
Range("b37").Select
ActiveCell.Value = 0
Worksheets("WogB").Select
Range("b34").Select
Application.ScreenUpdating = True
End If

End Sub

I cannot see what is wrong. When I click the checkbox. Nothing happens. Not even a error appears. I have also tried to use
ActiveCell.FormulaR1C1 = -14


Help please.

Regards,
Jonas
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

zendog1960

Active Member
Joined
Sep 27, 2003
Messages
453
Try this

Sub CheckBox1_Click()

If CheckBox1.Value = True Then
Application.ScreenUpdating = False
Worksheets("Data").Range("b37").Select
ActiveCell.Value = -14
Worksheets("WogB").Select
Range("b34").Select
Application.ScreenUpdating = True else

If CheckBox1.Value = False Then
Application.ScreenUpdating = False
Worksheets("Data").Select
Range("b37").Select
ActiveCell.Value = 0
Worksheets("WogB").Select
Range("b34").Select
Application.ScreenUpdating = True
End If

End Sub
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,958
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
No need to do all that selecting, but is the checkbox on a worksheet and if so which sheet?
 

Jonasraf

New Member
Joined
Jun 19, 2007
Messages
40
The checkbox is on the WogB sheet.

How can I skipp all the selecting?
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,958
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Try this:

Code:
Private Sub CheckBox1_Click()
Worksheets("Data").Range("B37") = 14 * CheckBox1.Value
Range("B34").Select
End Sub
 

Forum statistics

Threads
1,181,406
Messages
5,929,759
Members
436,687
Latest member
Glass of Gin

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
Top