+ Reply to Thread
Results 1 to 9 of 9

combine a recurrent worksheet from different workbooks into one workbook.

  1. #1
    Forum Contributor
    Join Date
    05-18-2011
    Location
    Delhi , India
    MS-Off Ver
    Excel 2007
    Posts
    171

    combine a recurrent worksheet from different workbooks into one workbook.

    i have a recurrent worksheet named R1 in all my workbooks containing in a folder NEW FOLDER. i want to combine all the R1 sheets in one workbook. thanks

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: combine a recurrent worksheet from different workbooks into one workbook.

    Check out this clip

    https://www.youtube.com/watch?v=6XsvI9i2z7s

  3. #3
    Forum Contributor
    Join Date
    05-18-2011
    Location
    Delhi , India
    MS-Off Ver
    Excel 2007
    Posts
    171

    Re: combine a recurrent worksheet from different workbooks into one workbook.

    @davesexcel : thanks, it's working perfectly. how do i change the macro so that it only copies the VALUE of the cells? thanks

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: combine a recurrent worksheet from different workbooks into one workbook.

    Change the one copy paste line to this
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    05-18-2011
    Location
    Delhi , India
    MS-Off Ver
    Excel 2007
    Posts
    171

    Re: combine a recurrent worksheet from different workbooks into one workbook.

    @davesexcel : it has started pasting values alright but now one problem has started happening. the workbooks which the macro opens now remain opened while before it was not happening like this. when the macro use to stop, all the workbooks use to closed at the end.

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: combine a recurrent worksheet from different workbooks into one workbook.

    You were just suppose to replace the one line.

    Let's see the code

  7. #7
    Forum Contributor
    Join Date
    05-18-2011
    Location
    Delhi , India
    MS-Off Ver
    Excel 2007
    Posts
    171

    Re: combine a recurrent worksheet from different workbooks into one workbook.

    Sub LoopThroughFolder()

    Dim MyFile As String, Str As String, MyDir As String, Wb As Workbook
    Dim Rws As Long, Rng As Range
    Set Wb = ThisWorkbook
    'change the address to suite
    MyDir = "C:\Users\asd\Desktop\Dec 2018\"
    MyFile = Dir(MyDir & "*.xlsm") 'change file extension
    ChDir MyDir
    Application.ScreenUpdating = 0
    Application.DisplayAlerts = 0

    Do While MyFile <> ""
    Workbooks.Open (MyFile)
    With Worksheets("R1")
    Rws = .Cells(Rows.Count, "A").End(xlUp).Row
    Set Rng = Range(.Cells(1, 1), .Cells(Rws, 65))
    Rng.Copy
    Wb.Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValuesAndNumberFormats
    Application.CutCopyMode = False
    End With
    MyFile = Dir()
    Loop

    End Sub

  8. #8
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: combine a recurrent worksheet from different workbooks into one workbook.

    Like I said, you were only supposed to change the one line of code, you don't have the line that closes the workbook.

  9. #9
    Forum Contributor
    Join Date
    05-18-2011
    Location
    Delhi , India
    MS-Off Ver
    Excel 2007
    Posts
    171

    Re: combine a recurrent worksheet from different workbooks into one workbook.

    yes sorry my mistake. just one more thing when i close this topic. i changed the pastevalue to PasteValuesAndNumberFormats. how do i also copy&paste the format of the cell as well?

+ 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. Combine Multiple Workbooks To One Workbook
    By lalahaedong_excel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-03-2018, 06:57 PM
  2. [SOLVED] combine multi workbooks into one master workbook but I want to combine only sheet 3
    By Goodstart14 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-31-2013, 12:22 AM
  3. Combine multiple workbooks in to new workbook
    By aetedford in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-28-2013, 01:29 PM
  4. Replies: 5
    Last Post: 02-25-2013, 08:21 AM
  5. Combine multisheet workbooks into one workbook
    By SMac2347 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-26-2012, 02:56 PM
  6. [SOLVED] Combine workbooks into one master workbook.
    By EKB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2006, 06:15 AM
  7. Combine multiple workbooks into one workbook
    By Rookie_User in forum Excel General
    Replies: 0
    Last Post: 01-13-2006, 03:00 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