Results 1 to 14 of 14

Thread: Help Please :)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,887
    Location
    You could modularize this a lot more by having a sub to process a file that takes the path, source range, and destination range in Master

    This is very crude

    Option Explicit
    
    Sub Alt1_Demo()
        Dim sFilename As String
        Dim wb1 As Workbook, wb2 As Workbook
        
        Set wb1 = ThisWorkbook  '   probably "Document Tracker.xlsm"
        
        sFilename = "IPW-CAP-00-XX-RE-Z-0001.xlsx"
         
         Set wb2 = Workbooks.Open (Filename:="X:\089872 - IPW - Framework\02 Admin\01 DocRegisters\" & sFilename)
         
        wb2.Worksheets("Framework").Range("D6:D10").Copy
        wb1.Worksheets("Something").Range("B7:B11").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
        
        wb2.Close False
    End Sub
    Last edited by mdmackillop; 05-25-2017 at 01:43 AM. Reason: Set wb2 added
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

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