Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RJB RJB is offline
external usenet poster
 
Posts: 86
Default Using a Macro Button to Move to a Different Cell

I have a form, where, based on what Option Button the user clicks, should
display a different next question.

In other words, if you click "Yes" and then press the "Submit Answer"
button, you should be taken to an area named "Answer_A". If you click "No"
and then press the "Submit" you should be taken to an area named "N".

The "Submit Answer" button is assigned to Macro "Answer_Q1".

I have my option buttons linked to cell J8 - "Yes" is 1, "No" is 2.

Here's Macro "Answer_Q1":

Sub Answer_Q1()
If J8 = 2 Then
Application.Goto reference:="N", Scroll:=True
ElseIf J8 = "1" Then
Application.Goto reference:="Answer_A", Scroll:=True
End If
End Sub

When I click the "Submit" button, NOTHING happens. I tried changing the
option buttons to a drop-down box (and appropriately changed the variables in
the macro, natch), and still nothing happens.

Thoughts?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Using a Macro Button to Move to a Different Cell

This worked for me:

Sub Answer_Q1()
If Range("J8").Value = 2 Then
Application.Goto reference:="N", Scroll:=True
ElseIf Range("J8").Value = 1 Then
Application.Goto reference:="Answer_A", Scroll:=True
End If
End Sub

Mike F
"RJB" wrote in message
...
I have a form, where, based on what Option Button the user clicks, should
display a different next question.

In other words, if you click "Yes" and then press the "Submit Answer"
button, you should be taken to an area named "Answer_A". If you click "No"
and then press the "Submit" you should be taken to an area named "N".

The "Submit Answer" button is assigned to Macro "Answer_Q1".

I have my option buttons linked to cell J8 - "Yes" is 1, "No" is 2.

Here's Macro "Answer_Q1":

Sub Answer_Q1()
If J8 = 2 Then
Application.Goto reference:="N", Scroll:=True
ElseIf J8 = "1" Then
Application.Goto reference:="Answer_A", Scroll:=True
End If
End Sub

When I click the "Submit" button, NOTHING happens. I tried changing the
option buttons to a drop-down box (and appropriately changed the variables
in
the macro, natch), and still nothing happens.

Thoughts?

Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
RJB RJB is offline
external usenet poster
 
Posts: 86
Default Using a Macro Button to Move to a Different Cell

When I run it. NOTHING happens. No error messages, but no movement either!

"Mike Fogleman" wrote:

This worked for me:

Sub Answer_Q1()
If Range("J8").Value = 2 Then
Application.Goto reference:="N", Scroll:=True
ElseIf Range("J8").Value = 1 Then
Application.Goto reference:="Answer_A", Scroll:=True
End If
End Sub

Mike F
"RJB" wrote in message
...
I have a form, where, based on what Option Button the user clicks, should
display a different next question.

In other words, if you click "Yes" and then press the "Submit Answer"
button, you should be taken to an area named "Answer_A". If you click "No"
and then press the "Submit" you should be taken to an area named "N".

The "Submit Answer" button is assigned to Macro "Answer_Q1".

I have my option buttons linked to cell J8 - "Yes" is 1, "No" is 2.

Here's Macro "Answer_Q1":

Sub Answer_Q1()
If J8 = 2 Then
Application.Goto reference:="N", Scroll:=True
ElseIf J8 = "1" Then
Application.Goto reference:="Answer_A", Scroll:=True
End If
End Sub

When I click the "Submit" button, NOTHING happens. I tried changing the
option buttons to a drop-down box (and appropriately changed the variables
in
the macro, natch), and still nothing happens.

Thoughts?

Thanks!




  #4   Report Post  
Posted to microsoft.public.excel.programming
RJB RJB is offline
external usenet poster
 
Posts: 86
Default Using a Macro Button to Move to a Different Cell

Scratch that. I started from the beginning, and it works fine.

Hmmm.....

Thanks!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Button macro to move/delete active row KevHardy Excel Discussion (Misc queries) 4 February 13th 10 11:59 AM
move to a different cell with the arrow button. skump Excel Discussion (Misc queries) 3 December 14th 07 06:07 PM
Move Macro Button on Sheet to a toolbar Dan Excel Discussion (Misc queries) 3 March 10th 07 08:04 PM
Macro to Move Excel Button [email protected] Excel Programming 2 June 9th 06 04:55 PM
How to move a button with an assinged macro Dean[_8_] Excel Programming 2 May 5th 06 07:49 AM


All times are GMT +1. The time now is 09:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"