Results 1 to 2 of 2

VBA Copy Active worksheet to all workbooks in folder

Threaded View

  1. #1
    Registered User
    Join Date
    08-25-2006
    Posts
    1

    VBA Copy Active worksheet to all workbooks in folder

    Hi VBA Guru's

    I've been looking all day for Copy Active worksheet to all workbooks in folder. I need to copy my sheet "Data Overview" to all workbooks in C:/Asia, I'm using excel 2007 I tried this code below but it says it can't open the file error 1004


     
    Sub UpdateAllWorkbooks()
    
      Dim MyFolder As String
      Dim SrcWks As Worksheet
      Dim Wkb As Workbook
      Dim WkbName As String
      
        Set SrcWks = ThisWorkbook.Worksheets("Data Overview")
        MyFolder = "C:\Asia"
        
          WkbName = Dir(MyFolder & "\*.xlsx")
            Do While WkbName <> ""
              Set Wkb = Workbooks.Open(WkbName)
                SrcWks.Copy Before:=Wkb.Worksheets("Sheet1")
                Wkb.Close SaveChanges:=True
              WkbName = Dir()
            Loop
            
    End Sub
    Thanks in advance
    Last edited by adainty; 05-19-2011 at 02:22 AM.

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