Removing External Links in Excel SpreadSheet:
Some Microsoft Excel Spreadsheet will have links to other workbooks. If this needs to be broken use the following code:
Sub Remove_External_Links_in_Cells()
Dim LinkCell
Dim FormulaCells As Range
Dim SheetsInWorkbook As Object
For Each SheetsInWorkbook In Sheets
SheetsInWorkbook.Activate
'*** Error trapping if no formulacells found
On Error Resume Next
'*** Select only formula cells
Set FormulaCells = Cells.SpecialCells(xlFormulas)
'*** Loop every formulacell in sheet
For Each LinkCell In FormulaCells
'*** If you want paste linked value as "normal value"
MsgBox LinkCell.Parent.Name
If InStr(1, LinkCell.Value, ".xls]") = 0 Then
LinkCell.Value = LinkCell
End If
Next
Next
End Sub
Friday, December 08, 2006
Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.
Yeah but what if you have a sheet with no formulas? The code crashes.
ReplyDeleteThis code sucks and doesnt work. Sorry you have failed.
ReplyDeleteTry looking for bad named ranges. If you have any named ranges that are pointing to an errant range (particularly located in another workbook), they should be deleted.
ReplyDelete