+ Reply to Thread
Results 1 to 10 of 10

Drop Down List hyperlink to sheets in another workbook

Hybrid View

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    Saldanha, South Africa
    MS-Off Ver
    Excel 2010
    Posts
    59

    Re: Drop Down List hyperlink to sheets in another workbook

    I unfortunately are not able to watch youtube.

    When in your Master Plan, press Alt & F11 to open the Visual Basic editor, then select ThisWorkbook under Master Plan.xlsx top left. Paste this code under your ThisWorkbook

    Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
    If Mid(ActiveCell.Address, 2, 1) = "B" Then
        Call open_sheet
    End If
    End Sub
    Then right click on the same ThisWorkbook and choose Insert > Module, a new module will appear under modules. Copy the following code into the module.

    Sub open_sheet()
    
       sheet_name = ActiveSheet.Name
        open_name = ActiveCell.Value
    
        Select Case sheet_name
    
        Case "Cabinet"
        Workbooks("Stock Plan Cabinet.xlsx").Activate
        Worksheets("sheet" & open_name).Select
    
        Case "Raw Material"
        Workbooks("Stock Plan Raw Material.xlsx").Activate
        Worksheets("sheet" & open_name).Select
    
        Case "Store"
        Workbooks("Stock Plan Store.xlsx").Activate
        Worksheets("sheet" & open_name).Select
    
        End Select
    
    End Sub
    Now when you double click on the number in the Master Plan then it will open that sheet. Try to understand this few lines of code, it's not that difficult, so that you can add to it if you add more files or change the names of your files.

  2. #2
    Forum Contributor
    Join Date
    08-30-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    141

    Re: Drop Down List hyperlink to sheets in another workbook

    I already try and I understand that code. but when i double click at the number, the vba appear this and highlight the "Sheetlist":

    Sheets("Sheetlist").Select
    Range("A1").Select
    
    For i = 1 To Workbooks("Stock Cabinet.xls").Worksheets.Count
       ActiveCell.Value = ActiveWorkbook.Worksheets(i).Name
       ActiveCell.Offset(1, 0).Select
    Next
    Why does this happen?
    Last edited by Cutter; 09-03-2012 at 01:43 PM. Reason: Added code tags

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1