July 11, 2020
Sir/Mam,
I have written a code that opens an excel file based upon the path provided, but the new excel get open as a new worksheet, Can it be opened as another sheet in the same workbook?
Kindly help me with the modification in the code as attached. Cell D4 contains the address of the file that i want to open.
Sub work()
Dim my as string
my=range("d4").value
Workbooks.open my
Activeworkbook.close
end sub
Regards.
Trusted Members
December 20, 2019
Its much easier if you add a workbook rather than paste in a peice of code
Add ActiveSheet.Move before:=Workbooks("OpenFile.xlsm").Sheets(1) after you open in and delete the activeworkbook.close
Sub work()
Dim my As String
my = Range("d4").Value
Workbooks.Open my
ActiveSheet.Move before:=Workbooks("OpenFile.xlsm").Sheets(1)
'ActiveWorkbook.Close
End Sub
1 Guest(s)