Help in Excel

Rahulwork

Active Member
Joined
Jun 9, 2013
Messages
284
Hi Team

I have 10 worksheets in Excel.

Name of sheet A, B, ........J

I have a drop down at sheet 11 -- @ A1 in which all sheet's name are there.

Now i want when i select B from drop down and click on button. macro automatically show me sheet B.

Please help me in this. do let me know in case of any further query or clarification on question

Regards
Rahul
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

pdevito3

Board Regular
Joined
Dec 17, 2013
Messages
246
Make a copy of your workbook. This way you won't mess up the original somehow. Press alt+f11 and find the sheet 11 on the left side. paste the code below into the sheet and try changing your combobox


Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

Application.ScreenUpdating = False

Dim ws As Worksheet

If Target.Address = "$A$1" Then
    For Each ws In Worksheets
        Select Case ws.Name
            Case Range("A1").Value
                ws.Visible = True
            Case ActiveSheet.Name
                ws.Visible = True
            Case Else
                ws.Visible = False
        End Select
    Next ws
End If

Application.ScreenUpdating = True

End Sub
 
Upvote 0

Rahulwork

Active Member
Joined
Jun 9, 2013
Messages
284
I have this code

Sub Button1_Click()
Worksheets(Range("A1").Value).Activate
End Sub

by this desire sheet is selected but i want to specify the cell as well. please help
 
Upvote 0

jtakw

Well-known Member
Joined
Jun 29, 2014
Messages
7,245
Office Version
  1. 2016
Platform
  1. Windows
May be this:

Code:
Sub Button1_Click()
 Worksheets(Range("A1").Value).Activate
Dim sh As Worksheet
Set sh = ActiveSheet
sh.Cells(1, 4).Select
 End Sub

1 is row index, 4 is column index, insert whatever you need.
 
Upvote 0

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,907
Office Version
  1. 365
Platform
  1. Windows
but i want to specify the cell as well. please help

Another option:

Rich (BB code):
Sub Button1_Click()
Application.Goto Worksheets(Range("A1").Value).Range("C10"), True
End Sub
 
Upvote 0

pdevito3

Board Regular
Joined
Dec 17, 2013
Messages
246
Whoops, misread. This should do the trick:

Code:
Sub Button1_Click()
Worksheets(Range("A1").Value).Range("[COLOR=#ff0000]A2[/COLOR]").Activate 'change the range as appropriate where it says "A2" 
End Sub

If you want to hide all the sheets too, use this code:

Code:
Option Explicit  
Private Sub Button1_Click()  

Application.ScreenUpdating = False  Dim ws As Worksheet  If Target.Address = "$A$1" Then     For Each ws In Worksheets         Select Case ws.Name             Case Range("A1").Value                 ws.Visible = True             Case ActiveSheet.Name                 ws.Visible = True             Case Else                 ws.Visible = False         End Select     Next ws End If [COLOR=#ff0000]
Worksheets(Range("A1").Value).Range("A2").Activate[/COLOR] 'change the range as appropriate where it says "A2"  

Application.ScreenUpdating = True
  
End Sub
</pre>
 
Upvote 0

Forum statistics

Threads
1,191,694
Messages
5,988,142
Members
440,129
Latest member
bianca88

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