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

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
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
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
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
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
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,214,422
Messages
6,119,396
Members
448,891
Latest member
tpierce

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