Button with macro, based on input in dropdown

Junior19

New Member
Joined
Nov 23, 2007
Messages
6
I'm currently working on a schedule, with 52 weeks.
In order to make it easier to move around in the schedule I've tried different methods, one week on separate sheets, all weeks on same sheet below each other, and so on.

I've now figured that the best way would be to use a single sheet, with 52 weeks below eachother, and to freeze the top row, and put a validation drop-down menu in Cell B1 where I select the week I want to go to, and a command-button with a macro that jumps down to the week in question.

I've got the weeknumbers in column A. Column B and C are reserved for the name and position of the person, and column D-J holds the week-schedule.

I'm just about to tear out my eyes, because I know this should be dead easy. But I seem to have forgotten everything I've ever learned, because I can't see the code..

Anyone?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
Private Sub CommandButton1_Click()
Dim Found As Range
Set Found = Columns("A").Find(what:=Range("B1").Value, LookIn:=xlValues, lookat:=xlWhole)
If Found Is Nothing Then
    MsgBox "Not found", vbInformation
Else
    Found.Select
End If
End Sub
 
Upvote 0

Junior19

New Member
Joined
Nov 23, 2007
Messages
6
This has done the trick.
Much appreciated.

Think I got stuck in thinking to much on hlookups and such.

Thanks a million!
 
Upvote 0

Forum statistics

Threads
1,191,690
Messages
5,988,037
Members
440,125
Latest member
vincentchu2369

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
Top