jpmccreary
New Member
- Joined
- Jul 21, 2010
- Messages
- 11
I have a form with about 15 check boxes. A few columns over I have an important message that I want displayed when the check box is checked. I know that I can write code for each checkbox to display it's message. Just trying what I thought would be a brilliant shortcut and code saver. I am trying to use the Worksheet Change event. I set the checkbox's linked cell to the cell 1 column to the right of the cell with the important message. The whole 'cell link' column is named "Target_Column". I use an InRange function to determine if a change is made in the Target_Column range. If it is, and the value of the target is true, the code is supposed to display a message that is equal to the target offset by -1 column (the important message cell).
This code works when I change the "target" manually but when I check the box, and the target changes, the event does not trigger. Is there something about the change from the check box that keeps the Worksheet Change event from firing? I have tried both Form and ActiveX checkboxes. Neither works.
Here is the event change code:
This code works when I change the "target" manually but when I check the box, and the target changes, the event does not trigger. Is there something about the change from the check box that keeps the Worksheet Change event from firing? I have tried both Form and ActiveX checkboxes. Neither works.
Here is the event change code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim sTarget As String
Dim sRange As String
Dim bInRange As Boolean
Dim sMessage As String
sTarget = Target.Address
sRange = Range("Target_Column").Address
bInRange = InRange(Range(sTarget), Range(sRange))
If bInRange = True And Target.Value = True Then
sMessage = Target.Offset(0, -1).Value
MsgBox "Distribution Restrictions: " & sMessage, vbOKOnly
End If
End Sub
Dim sTarget As String
Dim sRange As String
Dim bInRange As Boolean
Dim sMessage As String
sTarget = Target.Address
sRange = Range("Target_Column").Address
bInRange = InRange(Range(sTarget), Range(sRange))
If bInRange = True And Target.Value = True Then
sMessage = Target.Offset(0, -1).Value
MsgBox "Distribution Restrictions: " & sMessage, vbOKOnly
End If
End Sub
Last edited: