+ Reply to Thread
Results 1 to 4 of 4

Copy from single workbook and past to multiple workbooks

  1. #1
    Registered User
    Join Date
    06-26-2012
    Location
    london, england
    MS-Off Ver
    Excel 2010
    Posts
    5

    Copy from single workbook and past to multiple workbooks

    I have a master file with a few lists in it and I would to have it so when I update the list it updates all the lists in the other workbooks.
    Here is what I have so far:
    Sub UpdateList()

    Dim wbk As Workbook
    Dim fPATH As String
    Dim fNAME As String
    Dim ws As Worksheet



    fPATH = "C:\Filepath"
    fNAME = Dir(fPATH & "Time*.xls")

    Range("A2:E97").Select
    Selection.Copy

    Do While Len(fNAME) > 0
    Set wbk = Workbooks.Open(fPATH & fNAME)
    For Each ws In wbk.Worksheets
    If ws.Range("A1").Value = "BMI Timesheet" Then
    With wbk.Sheets("Sheet1")
    Range("C22:G117").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
    False, Transpose:=False
    End With
    End If
    Next ws
    wbk.Close False
    fNAME = Dir
    Loop
    End Sub

    This goes though and opens each workbook but it does not seem to copy the newly entered data.

    Any advice on what I am doing wrong?

    ListEditor is the master file

    ListEditor.xlsTimeCardBMITemplateV2.xls

  2. #2
    Registered User
    Join Date
    01-01-2005
    MS-Off Ver
    2007
    Posts
    368

    Re: Copy from single workbook and past to multiple workbooks

    I am not really sure if this what you want, but try it.
    Please Login or Register  to view this content.
    Elio Fernandes

  3. #3
    Registered User
    Join Date
    06-26-2012
    Location
    london, england
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Copy from single workbook and past to multiple workbooks

    Perfect! Thanks for the help, do you know why the way I was attempting to do it wasn't working? (This is only my second macro so I'm a little slow)

  4. #4
    Registered User
    Join Date
    01-01-2005
    MS-Off Ver
    2007
    Posts
    368

    Re: Copy from single workbook and past to multiple workbooks

    Because you are just starting with macros, try to run your code and my code step-by-step in VBE by pressing F8 and see the difference yourself.

    Regards,
    Elio Fernandes

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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