I use validation dropdown list to open some subworkbooks from this Main workbook “Main.xls”, i only need one subworkbook opened, if user opening a new subworkbook, the one that is already opened should be closed, what is the codes for this event? thanks for any help
Code:
Sub Open_Doc()
Application.ScreenUpdating = False
Workbooks.Open Filename _
:=Sheets("Sheet1").Range("B2").Value & Sheets("Sheet1").Range("C2").Value
Workbooks("Main.xls").Activate
Application.ScreenUpdating = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("C2")) Is Nothing Then
Select Case Range("C2")
Case "Doc_01.xls": Open_Doc
Case "Doc_02.xls": Open_Doc
Case "Doc_03.xls": Open_Doc
Case "Doc_04.xls": Open_Doc
Case "Doc_05.xls": Open_Doc
End Select
End If
End Sub
Bookmarks