+ Reply to Thread
Results 1 to 2 of 2

distributing data from main sheet to many workbooks in folder based on partial name

  1. #1
    Registered User
    Join Date
    11-21-2012
    Location
    egypt
    MS-Off Ver
    2007
    Posts
    2

    distributing data from main sheet to many workbooks in folder based on partial name

    i have main excel sheet that have all customers transactions and customer id , and there is a file that contain many excel workbooks and part of their names contain the customer id, i want to copy the data from the main excel sheet using vba code and search for the customer workbook in the folder based on customer id and then past the data that belong that customer in a specific range.
    can anyone help me ?????????
    Last edited by hazem1f; 02-17-2016 at 05:57 AM.

  2. #2
    Registered User
    Join Date
    11-21-2012
    Location
    egypt
    MS-Off Ver
    2007
    Posts
    2

    Re: distributing data from main sheet to many workbooks in folder based on partial name

    Sub Test()

    Dim sheetname As String
    Dim SourcePath As String, DestPath As String, FName As String, sh As Worksheet, rng As Range, c As Range

    SourcePath = "C:\Users\acc11.ANSARYNEW\Desktop\test\"


    For Each sh In Worksheets


    sheetname = sh.Name
    sh.Range("a1", "f4").Copy


    FName = dir(SourcePath & sheetname & "*.xls")


    On Error Resume Next

    Workbooks.Open SourcePath & FName
    FName = dir()


    ActiveWorkbook.Worksheets("1").Paste
    Next sh


    End Sub



    this code open workbook that have part of the sheet name in the main workbook and copy data from each sheet but still can not copy the data that belongs each workbook accurately and past it in a specific range in the workbook

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Open all workbooks in a folder and copy the first seeht> Paste to New Main workbook.
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-22-2014, 01:56 PM
  2. [SOLVED] Display data from sheets based on value in a cell on main sheet.. Help!
    By cpyter in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-29-2014, 02:20 PM
  3. Pull data from multiple sheets based on cell in Main sheet
    By cpyter in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-29-2014, 01:19 PM
  4. [SOLVED] Loop to open all workbooks in folder and append data to single sheet
    By beng404 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-04-2013, 01:45 PM
  5. Replies: 1
    Last Post: 03-28-2013, 02:49 PM
  6. Distributing a macro or new sheet to existing workbooks
    By runswick in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-22-2013, 01:52 PM
  7. [SOLVED] Loop through all sub-folders of a main folder and rename sheet same as workbook name
    By sans in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 12-11-2012, 02:01 PM

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