+ Reply to Thread
Results 1 to 2 of 2

Help Pasting Link in Another Workbook

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-18-2014
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2013
    Posts
    197

    Help Pasting Link in Another Workbook

    I'm trying to copy links to my current workbook into another workbook. The following code works, but it's slow cause I have to do it multiple times... and it's inelegant. I usually try to avoid activating and selecting, but I can't seem to do the Paste Link:=True without it. Any ideas?

    Set wbk = Application.ThisWorkbook
    Set wbk2 = Workbooks("Display Workbook.xlsx")
    
        Range("L13:O17").Copy
        wbk2.Activate
        Range("H12").Select
        ActiveSheet.Paste Link:=True
        wbk.Activate

    thanks!
    Kate

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,271

    Re: Help Pasting Link in Another Workbook

    Quote Originally Posted by phelbin View Post
    ... and it's inelegant ...
    ???
    If it works correctly it is elegant ...
    Option Explicit
    
    Sub copy_and_establish_links_to_source()
    Dim wbk As Workbook, wbk2 As Workbook
    Dim wbkSht As Worksheet, wbk2Sht As Worksheet
    
        Application.ScreenUpdating = False
        
        Set wbk = ThisWorkbook
        Set wbkSht = wbk.Sheets("Sheet1")
        
        Set wbk2 = Workbooks("Display Workbook.xls")
        Set wbk2Sht = wbk2.Sheets("Sheet1")
        
        wbk.Activate
        wbkSht.Range("L13:O17").Copy
        
        wbk2.Activate
        wbk2Sht.Activate
        wbk2Sht.Range("H12").Select
        wbk2Sht.Paste Link:=True
        wbk2Sht.Range("A1").Select
        Application.CutCopyMode = False
        
        wbk.Activate
        
        Application.ScreenUpdating = True
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Macro pasting link reference rather than value
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2016, 11:16 AM
  2. Pasting link from Excel into Word
    By Sun13Banjo in forum Excel General
    Replies: 8
    Last Post: 10-08-2015, 10:57 AM
  3. Pasting values that do not link directly to another workbook
    By Ezzard in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-04-2015, 02:26 PM
  4. Replies: 0
    Last Post: 01-28-2014, 02:45 PM
  5. Word Files hanging on Pasting as link
    By gaurav.itian in forum Excel General
    Replies: 0
    Last Post: 12-20-2009, 09:47 AM
  6. Problems pasting link + sort
    By jennyc2 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-27-2008, 07:09 AM
  7. need help on pasting link if certain cells blank
    By glennmasters@hotmail.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2006, 03:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1