Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Convert external links to internal

Hi,

I need to have a vba routine to get rid of external links. If someone copy
and paste sheet data between workbooks, there will often become external
references in the 'paste to workbook' pointing to the "copy from workbook'.
Before closing a workbook, I would like to check if there is any of these
links.

The best I found so far is the following from Steve Arbaugh, with minor
changes. However, it just delete the link completely. I just want to get rid
of the external part of the reference - the internal cell reference should
still be valid.

Can someone help me?

/Kindest regards

Function FindBookExtRefs()

Application.ScreenUpdating = False
Application.EnableEvents = False
Dim objRange As Range
Dim i As Integer
Dim j As Long


For Each Worksheet In ActiveWorkbook.Worksheets
Worksheet.Activate
Set objRange = ActiveSheet.UsedRange
For i = 1 To objRange.Columns.Count
For j = 1 To objRange.Rows.Count
objRange(j, i).Select
If InStr(objRange(j, i).Formula, "[") 0 Then
'there's an external reference
If MsgBox("There's an external reference to: " _
& objRange(j, i).Formula & _
" in cell: " & _
ActiveSheet.Name & " " & _
ActiveCell.Address & _
"; do you want to delete it?", _
vbYesNo) = vbYes Then _
objRange(j, i).Formula = Null
End If
Next j
Next i
Next

Application.ScreenUpdating = True
Application.EnableEvents = True
End Function



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
External link saved as internal - updating with Outlook [email protected] Links and Linking in Excel 1 August 15th 07 01:26 AM
Break internal links doublew Excel Discussion (Misc queries) 3 May 2nd 07 04:42 PM
Internal Links Sean Excel Discussion (Misc queries) 2 February 6th 07 12:12 PM
Internal links not working... [email protected] Excel Discussion (Misc queries) 3 December 29th 06 07:27 PM
Internal links Job Excel Programming 4 October 26th 05 07:33 PM


All times are GMT +1. The time now is 11:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"