Hi, vipulhumein,
it doesn't work after applying in this workbook
Where´s the code you used? I can´t look into your computer I´m afraid.
The code assumes that you open the workbooks in the same instance of Excel, not in different ones.
'This Workbook
Option Explicit
Private Sub Workbook_Open()
EF912816
End Sub
'Code Module
Option Explicit
Sub EF912816()
Dim wb As Workbook
Dim wbONE As Workbook
Dim wbTWO As Workbook
Const cstrWB_ONE As String = "Raw Data.xlsm" 'alter to suit name and extension
Const cstrWB_TWO As String = "Sample.xlsx" 'like above
Const cstrPATH As String = "C:\HaHoBe\Downloads\" 'alter the path to the workbooks, I
'assumed they both are located in the same place
For Each wb In Workbooks
If wb.Name = cstrWB_ONE Then
Set wbONE = wb
End If
If wb.Name = cstrWB_TWO Then
Set wbTWO = wb
End If
Next wb
If wbONE Is Nothing Then
Set wbONE = Workbooks.Open(cstrPATH & cstrWB_ONE)
End If
If wbTWO Is Nothing Then
Set wbTWO = Workbooks.Open(cstrPATH & cstrWB_TWO)
End If
End Sub
Ciao,
Holger
Bookmarks