Results 1 to 6 of 6

Thread: Linking Cells in Excel

Hybrid View

  1. #1
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Linking Cells in Excel

    mikeyc - You will also need the full path to the source workbook

    VB Code:
    1. Sub CreateLink()
    2. Dim sSourcePath As String
    3. Dim sSourceBook As String
    4. Dim sSourceSheet As String
    5. Dim sSourceRange As String
    6. Dim sFullAddress As String
    7.  
    8.     sSourcePath = "C:\Files\" 'Put the complete path to you source workbook here
    9.     sSourceBook = "YourSourceWorkbook.xls" 'put the name of your source workbook here
    10.     sSourceSheet = "YourSheetname" 'put the name of your sdource worksheet here
    11.     sSourceRange = "B12" 'put the address of the source cell here
    12.        
    13.     sFullAddress = "='" & sSourcePath
    14.     sFullAddress = sFullAddress & "[" & sSourceBook & "]"
    15.     sFullAddress = sFullAddress & sSourceSheet & "'!"
    16.     sFullAddress = sFullAddress & sSourceRange
    17.    
    18.     Range("C1").Formula = sFullAddress 'Put the cell where you want the link here
    19. End Sub
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  2. #2
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: Linking Cells in Excel

    Although you don't need the full path if the workbook you're looking for is in the same folder or a subfolder of the folder from which you're running the spreadsheet.

    zaza

Posting Permissions

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



Click Here to Expand Forum to Full Width