VBA to jump the Sheet on base of cell value

abmati

Board Regular
Joined
Jul 9, 2010
Messages
180
Hi Excel VBA Experts,
I have created a VBA to jump the Sheet on base of cell value.
But it does not work, can someone help me?
I have a Menu Sheet where a value has stores in B1 cell (Between 1 and 8)
If I click a Text Box link to this Macro, on the base of this value, need to go that Sheet.
Sub Menu_Sheet()
ThisWorkbook.Sheets("MENU").Select
Dim myOp As Integer
myOp = Range("B1").Value
If myOp = 1 Then ThisWorkbook.Sheets("Daily Data").Select
If myOp = 2 Then ThisWorkbook.Sheets("QNB Nexus").Select
If myOp = 3 Then ThisWorkbook.Sheets("Salary").Select
If myOp = 4 Then ThisWorkbook.Sheets("T Summary").Select
If myOp = 5 Then ThisWorkbook.Sheets("Muhsin").Select
If myOp = 6 Then ThisWorkbook.Sheets("Sponsor Fees").Select
If myOp = 7 Then ThisWorkbook.Sheets("S Summary").Select
If myOp = 8 Then ThisWorkbook.Sheets("Hassan Al Hilal").Select
End Sub

Thanks and Regards
 
Last edited:
I would think if that is the way you want to change the value in B1
You would need to use a Form control Spin button which when linked to B1 can increase or decrease the value by 1

Right click the Spin Button and look at Format Control
Set Minimum value to 1 and maximum value to 8
Since you only have 8 sheets in your script.

And put your script in the Spin Button
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,215,740
Messages
6,126,585
Members
449,319
Latest member
iaincmac

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