Jump to macro on button press

Aandyw42

Board Regular
Joined
Jul 6, 2009
Messages
53
Help required please...

On worksheet 'answers' a value between 1 and 200 can be entered into cell B8.

On worksheet 'questions' in the same workbook are a list of 200 questions number 1 to 200 listed in column B from row 37 to 230 (There are some gaps in between to make it look nice)

What I need is a macro I can assign to a button inside cell B8 in 'answers' worksheet which will jump to the corresponding question number in the 'questions' worksheet.

Example:

Action 1) No.'122' is entered into cell B8 on the 'answers' worksheet
Action 2) Press button in cell B8
Action 3) Macro will take me to the cell which contains question No.'122' in the 'questions' worksheet (this incidently would be cell B191)

thanks in advance!
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Code:
[COLOR="Blue"]Sub[/COLOR] JumpToQuestion()
    [COLOR="Blue"]With[/COLOR] Sheets("questions")
        .Cells(.Columns("B:B").Find(Sheets("answers").Range("B8")).Row, "B").Select
    [COLOR="Blue"]End[/COLOR] [COLOR="Blue"]With[/COLOR]
[COLOR="Blue"]End[/COLOR] [COLOR="Blue"]Sub[/COLOR]
 
Upvote 0
Hi and thanks for the swift reply,

When I run the code I get this 'select method of range class failed'
I inserted a module into the workbook and pasted it in so i'm sure thats ok.

Also....the range of boxes in the answers worksheet has now expanded. column B will have lots of boxes in which to enter a value, the range which was B8 only is now B8 to B63, again there are some blank rows in there for cosmetic reasons.
 
Upvote 0
Select cell in "answers" sheet which you want to find and run Sub.
Code:
[COLOR="Blue"]Sub[/COLOR] JumpToQuestion()
    [COLOR="Blue"]With[/COLOR] Sheets("questions")
        .Cells(.Columns("B:B").Find(ActiveCell).Row, "B").Select
    [COLOR="Blue"]End[/COLOR] [COLOR="Blue"]With[/COLOR]
[COLOR="Blue"]End[/COLOR] [COLOR="Blue"]Sub[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,827
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