Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / February 2007

Tip: Looking for answers? Try searching our database.

How to remove the file link from the formula?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jignesh Gandhi - 23 Feb 2007 19:58 GMT
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(ControlFile).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
ShaneDevenshire - 23 Feb 2007 21:03 GMT
Assuming that the formulas should be linked to the same cell but in the
current workbook and not the external workbook, you can choose the command
Edit, Links, Change Source and specify your current workbook.

Signature

Cheers,
Shane Devenshire

> Hi
>
[quoted text clipped - 33 lines]
> Thanks & Regards
> Jignesh Gandhi
Jignesh Gandhi - 23 Feb 2007 21:23 GMT
Hi

Thanks for your reply. But I want to do it programmatically and not
using the menu option. I have mentioned it in my post.

Thanks
Jignesh Gandhi
ShaneDevenshire - 24 Feb 2007 16:33 GMT
Hi,

You could try this, it works for me:

Cells.Replace What:="[*]", Replacement:="", LookAt:=xlPart, SearchOrder _
       :=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
Signature

Thanks,
Shane Devenshire

> Hi
>
[quoted text clipped - 3 lines]
> Thanks
> Jignesh Gandhi
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.