Ozgrid Excel Help & Best Practices Forums


XL Templates | XL Add-ins | XL Training | XL Estimating | XL Scheduling | XL Recovery | XL Trading | XL Financial | XL Conversion | XL Charting


+ Reply to Thread
Results 1 to 6 of 6

Thread: Combine xls

  1. #1
    Join Date
    16th May 2003
    Posts
    4

    Download Active Data For Excel > > DETAILS > >
    hi,
    I have many excel files and the format for all is same
    (format of columns and rows)my question is how can I make a program that combine these to one Excel file with
    VB.Net or VB 6 and If there is also a program it sounds great !

  2. #2
    Join Date
    15th April 2003
    Location
    USA
    Posts
    7,228
    Welcome to the Board!
    How do you want to combine them? Append them, add common cells together? Make them separate sheets in one workbook? Why VB.net or VB 6? Why not VBA?

  3. #3
    royUK is offline Publishes Private Messages
    Join Date
    26th January 2003
    Location
    Lincolnshire,UK
    Posts
    12,876
    I have used this code to combine several Workbooks. Each Workbook must be open for it to work. I only use to gather Timesheets from several employees (one sheet per book) into one Workbook

    Sub Combine()

    Dim NewFileName As String
    Dim c As Integer
    Dim SheetCount As Integer

    NewFileName = ActiveWorkbook.Name
    c = 1
    Do Until c = 0
    If Windows(c).Visible = True Then
    Windows(c).Activate
    MsgBox ("New file to be created")
    NewFileName = Application.GetSaveAsFilename _
    (, "Microsoft Excel Workbook (*.xls),*.xls")
    ActiveWorkbook.SaveAs FileName:=NewFileName, _
    FileFormat:=xlWorkbookNormal
    NewFileName = ActiveWorkbook.Name
    ActiveSheet.Select
    c = 0
    SheetCount = ActiveWorkbook.Sheets.Count
    Else
    c = c + 1
    End If
    Loop
    For c = 1 To Workbooks.Count
    If Windows(c).Parent.Name <> NewFileName And Windows(c).Visible = True Then
    Windows(c).Activate
    ActiveWorkbook.Sheets.Copy after:=Workbooks(NewFileName).Sheets(SheetCount)
    End If
    Next c

    End Sub

  4. #4
    Join Date
    16th May 2003
    Posts
    4
    may you send the soource code I don&#039;t know how to use this source code please send the program that u compiled !


    regards
    H.B

  5. #5
    royUK is offline Publishes Private Messages
    Join Date
    26th January 2003
    Location
    Lincolnshire,UK
    Posts
    12,876
    hello mgpco

    The code that I have supplied will copy each sheet from any open Workbooks to the one running the code. You will have to set it up using the VB Editor in Excell. Click Alt F11 to open the Editor. Find the ThisWorkbook on the left of the screen. Click on it and use Insert&gt;Module Then paste the code in.

    Try this example Workbook

  6. #6
    Join Date
    16th May 2003
    Posts
    4

    Create Excel dashboards quickly with Plug-N-Play reports.
    Thanks for u&#039;re try but it&#039;s a little coplicating for me can u make it a little bit easier for me and describ it more about How i can use it ?


    Regards
    H.B

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

     

Possible Answers

  1. Combine several *.xls files into one
    By jonny in forum EXCEL HELP
    Replies: 8
    Last Post: July 20th, 2010, 10:14
  2. Combine 2 Macros Into One
    By Code Numpty in forum EXCEL HELP
    Replies: 3
    Last Post: June 18th, 2007, 18:49
  3. Combine Several Files Into One
    By vickyho1008 in forum EXCEL HELP
    Replies: 1
    Last Post: October 13th, 2006, 22:21
  4. Combine two chart
    By hierarchy in forum EXCEL HELP
    Replies: 3
    Last Post: October 26th, 2004, 17:53
  5. Combine
    By RaVon in forum EXCEL HELP
    Replies: 1
    Last Post: March 29th, 2004, 22:39

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