Excel VBA Macro Question

whyme6181

New Member
Joined
Oct 26, 2009
Messages
47
HI. I have a macro set up to note on a separate tab if a checkbox item was marked or not so I can use it in a future equation. Here is the code:

Code:
Private Sub Checkbox2_Change()
   If CheckBox2.Value = False Then
      Worksheets("Tic Sheet").Activate
      Range("B7") = "NO"
      Worksheets("Impact Analysis").Activate
   Else
      Worksheets("Tic Sheet").Activate
      Range("B7") = "YES"
      Worksheets("Impact Analysis").Activate
   End If
End Sub

The problem is that for whatever reason, the NO or YES will not be entered. The macro works and while in debug it will go through that line of code, but still no text is entered. Please help. Thanks,

Todd
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
You need to qualify the sheets like this:
Code:
Private Sub Checkbox2_Change()
If CheckBox2.Value = False Then
    With Worksheets("Tic Sheet")
        .Range("B7") = "NO"
    End With
    Worksheets("Impact Analysis").Activate
Else
    With Worksheets("Tic Sheet")
        .Range("B7") = "YES"
    End With
    Worksheets("Impact Analysis").Activate
End If
End Sub
 
Upvote 0
Thanks. A minute before you responded I figured out a variant. The below works as well

Code:
Private Sub Checkbox2_Change()
   If CheckBox2.Value = False Then
      Worksheets("Tic Sheet").Range("B7") = "NO"
   Else
      Worksheets("Tic Sheet").Range("B7") = "YES"      
   End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

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