Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi
I've a button on an excel file and clicking on it will copy sheets from another excel file. The sheets are copied but what happens is that in the copied sheets, in the formulas, it copies the file name from where the sheets are copied. Is there any way where I can just copy the sheets and formulas without copying links? Manually it can be done by Edit - Links and specify the current file name. But I want to do it programatically. Following is the code which copies the sheets. Sub GetFile() Dim FileName As String Dim FilePath As String Dim ControlFile As String Dim i As Integer ActiveWorkbook.Sheets("Loan Information").Select FilePath = ActiveWorkbook.Sheets("Loan Information").range("FilePath").Value FileName = ActiveWorkbook.Sheets("Loan Information").range("FileName").Value ControlFile = ActiveWorkbook.Name Workbooks.Open FileName:=FilePath & FileName For i = 1 To Sheets.Count Sheets(Trim(Sheets(i).Name)).Copy After:=Workbooks(ControlFile).Sheets(Workbooks(Con trolFile).Sheets.Count) Windows(FileName).Activate Next Windows(FileName).Activate Windows(FileName).Close SaveChanges:=False ActiveWorkbook.Save Windows(ControlFile).Activate End Sub Thanks & Regards Jignesh Gandhi |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to restore link in the formula via file saved from emails | Excel Discussion (Misc queries) | |||
how do i maintain same figure with formula link to another file | Excel Discussion (Misc queries) | |||
formula link to a file | Excel Worksheet Functions | |||
Q: Can a formula reference a cell to get the file name to link to for data? | Excel Discussion (Misc queries) | |||
Remove link to another workbook | New Users to Excel |