View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
RJB RJB is offline
external usenet poster
 
Posts: 86
Default Running code from form button

I would like to have a form where when a question is asked, if you click the
radio button (er, "Form Toolbox 'Option' button"), you will get different
results based on whether or not you click "Yes" or "No". (Separate buttons -
one for "yes" and one for "no")

I've assigned the Format control cell link to a certain cell, and then
written code referencing the value of that cell.

If I simply TYPE a "1" or a "2" in that cell (cell D8), the code runs fine.
But clicking the radio button (which changes the value of that cell to "1" or
"2") does nothing.

Is there a way to accomplish this?

Here's the code:

==========================
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$8" Then
If Target.Value = "2" Then
Application.Goto reference:="N", Scroll:=True
ElseIf Target.Value = "1" Then
Application.Goto reference:="Answer_A", Scroll:=True
End If
End If
==========================

Thanks for the help.