Results 1 to 2 of 2

Thread: VBA - Linking to other named workbooks
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jun 2013
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA - Linking to other named workbooks

    Dear All,

    I hope this wonderful forum could help please. I gain alot of experience and knowledge from people on here so firstly a thank you for that.

    I've looked on the forum but am unable to find the answer the to query below (I may not be wording it correctly).

    The code I'm trying to write is basically a cycle code that creates standard links to another file that is named in the macro - like so.

    Code:
    Sub LoopThroughSheets()
    
    
    'Set the results file
    Dim rwb As Workbook
    Set rwb = Workbooks("Actuals.xlsx")
    
    
    'Set the reference (current) workbook
    Dim PMWB As Workbook
    Set PMWB = Workbooks("Forecast.xlsm")
    
    
    'Set the column of the file - plus 1 each month
    Dim mycolumn As Integer
    mycolumn = 5
    
    
    
    
        Dim Sheets As Variant
        Dim Sheet As Variant
    
    
        Sheets = Array("S1", "S2", "S3")
    
    
        For Each Sheet In Sheets
            
        'This needs to change per sheet
        Dim myrow As Integer
        myrow = 30
                
                
            Cells(30, mycolumn).Select
            ActiveCell.Formula = "='[" & rwb & "]Actual'!C" & myrow
            Cells(64, mycolumn).Select
            ActiveCell.Formula = "='[" & rwb & "]Actual'!C" & myrow
            Cells(113, mycolumn).Select
            ActiveCell.Formula = "='[" & rwb & "]Actual'!C" & myrow
            
        Next Sheet
    
    
    End Sub
    Any and all help would be greatly appreciated.

    Thank you in advance

    GG452

  2. #2
    New Member
    Join Date
    Jun 2013
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA Help - Linking to other named workbooks

    Bump

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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