+ Reply to Thread
Results 1 to 9 of 9

Copying data from one workbook sheet to another workbook sheet without overwrriting

Hybrid View

Amol1988 Copying data from one... 07-01-2014, 05:42 AM
Naveed Raza Re: Copying data from one... 07-01-2014, 07:08 AM
Amol1988 Re: Copying data from one... 07-01-2014, 07:12 AM
HaHoBe Re: Copying data from one... 07-01-2014, 07:18 AM
Amol1988 Re: Copying data from one... 07-07-2014, 08:39 AM
Amol1988 Re: Copying data from one... 07-08-2014, 05:52 AM
Naveed Raza Re: Copying data from one... 07-08-2014, 11:23 PM
Amol1988 Re: Copying data from one... 07-09-2014, 01:58 AM
Naveed Raza Re: Copying data from one... 07-08-2014, 11:14 PM
  1. #1
    Registered User
    Join Date
    06-25-2014
    Location
    pune
    MS-Off Ver
    2010
    Posts
    5

    Cool Copying data from one workbook sheet to another workbook sheet without overwrriting

    The two sheets are...

    1. Sheet1.xlsx (regular excel sheet as the extension is .xlsx)
    2. Consolidated.xlsm (macro enabled sheet as its extension is .xlsm)

    1. Copy both the files on your system under a particular folder.
    2. Now make 9 replica's of Sheet1.xlsx and name them as Sheet2, Sheet3, Sheet4, .......... Sheet10
    3. Open the sheet Consolidated.xlsm and see the button i have added called "Pull Data".
    Now write down the code by adding a Module in that excel sheet from the code window.
    4. Write a code that will open each of these sheets (Sheet1, Sheet2, Sheet3, Sheet4, .......... so on) one at a time and will copy the data from these sheets to the Consolidated.xlsm sheet.
    5. Make sure that the data is appended(and not overwritten) from the multiple sheets (Sheet1, Sheet2, Sheet3). that is once you paste the data from sheet1 to Consolidated.xlsm then the Sheet2 data will be pasted at the end and after that sheet3 data will be pasted and so on..
    6. In this way at the end we will have all the data from Sheet1, Sheet2, Sheet3...in the consolidated sheet.
    7. The Division column in the Consolidated sheet will have the value of first row in these multiple sheets. So after making the replicas of Sheet1, please change the value in first row (Range A1) to any other value to avoid the confusion.
    8. I have highlighted the data for two sheets in yellow and grey color in the consolidated sheet. Thus you will get an idea of what needs to be done.

  2. #2
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Copying data from one workbook sheet to another workbook sheet without overwrriting

    please share the both workbooks
    Thanks - Naveed
    -----------------------------
    If the suggestion helps you, then Click * to Add Reputation
    To Attach File: Go Advanced>>Manage Attachments>>Add Files (In Top Right Corner)>>SelectFiles>>.........Locate Your File(s)>>Upload Files>>Done (In Bottom Right)
    1. Use [code] code tags [\code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  3. #3
    Registered User
    Join Date
    06-25-2014
    Location
    pune
    MS-Off Ver
    2010
    Posts
    5

    Re: Copying data from one workbook sheet to another workbook sheet without overwrriting

    Hi, thanks for your reply...
    I have attached both the files...
    Thanks
    Amol
    Attached Files Attached Files

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Copying data from one workbook sheet to another workbook sheet without overwrriting

    Hi, Amol1988,

    have a look at WBs to 1 Sheet or Merge data from all workbooks in a folder to get you started.

    Besides the description looks like some sort of homework to me.

    Ciao,
    Holöger
    Last edited by JBeaucaire; 12-26-2019 at 05:28 PM.
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  5. #5
    Registered User
    Join Date
    06-25-2014
    Location
    pune
    MS-Off Ver
    2010
    Posts
    5

    Re: Copying data from one workbook sheet to another workbook sheet without overwrriting

    Please anyone can help me to solve above all issue...

  6. #6
    Registered User
    Join Date
    06-25-2014
    Location
    pune
    MS-Off Ver
    2010
    Posts
    5

    Cool Re: Copying data from one workbook sheet to another workbook sheet without overwrriting

    i have done some coding but it will only copy some amount of data to another workbook.I want to copy whole data of sheet1 into another workbook without overwrite...please check my below code..

    Sub GatherDataMacro_for_bkutkut()
        
        Dim strPaths As Variant: strPaths = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls*), *.xls*", _
                                                                        MultiSelect:=True)
        If Not IsArray(strPaths) Then Exit Sub
        Application.ScreenUpdating = False
        
        Dim wsDest As Worksheet: Set wsDest = ActiveWorkbook.Sheets("Sheet2")
        Dim wbData As Workbook, wbIndex As Long, rngDest As Range
        
        For wbIndex = UBound(strPaths) To 1 Step -1
            Set wbData = Workbooks.Open(strPaths(wbIndex))
            If Trim(wsDest.[B7].Value) = vbNullString Then
                Set rngDest = wsDest.[B7]
            Else
                Set rngDest = wsDest.[B6].End(xlDown).Offset(1, 0)
            End If
            rngDest.Resize(1, 17).Value = wbData.Sheets("Sheet1").[A1:Q1].Value
            wbData.Close False
        Next wbIndex
        
        Application.ScreenUpdating = True
        
    End Sub
    Last edited by JBeaucaire; 07-11-2014 at 10:58 PM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  7. #7
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Copying data from one workbook sheet to another workbook sheet without overwrriting

    Hi Amol

    please find the attached Consoldate Macro File.

    - Open the File and click on Pull Data Button and it will ask you select the files then select whatever the files you want to consoldate.

    Sub Pull_data()
    Dim FPath As Variant: FPath = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls*), *.xls*", _
                                                                        MultiSelect:=True)
    If Not IsArray(FPath) Then Exit Sub
    
    Dim CSht As Worksheet: Set CSht = ThisWorkbook.Sheets("Sheet2")
    CSht.Range("A2:A" & CSht.Cells(CSht.Rows.Count, 1).End(xlUp).Row + 1).ClearContents
    Dim FSht As Worksheet, LR As Long, FName As Long, Wb As Workbook
    For FName = UBound(FPath) To 1 Step -1
        LR = CSht.Cells(CSht.Rows.Count, 1).End(xlUp).Row + 1
        Set Wb = Workbooks.Open(FPath(FName))
        Set FSht = Wb.Sheets("Sheet1")
        FSht.Range("A3:A" & FSht.Cells(FSht.Rows.Count, 1).End(xlUp).Row).EntireRow.Copy
            CSht.Range("A" & LR).PasteSpecial xlPasteAll
        Application.CutCopyMode = False
        Wb.Close False
    Next
    CSht.Select
    CSht.Range("A1").Select
    MsgBox "Done !"
    End Sub
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    06-25-2014
    Location
    pune
    MS-Off Ver
    2010
    Posts
    5

    Red face Re: Copying data from one workbook sheet to another workbook sheet without overwrriting

    Thanks Navved .... i used that code ..its work fine

  9. #9
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Copying data from one workbook sheet to another workbook sheet without overwrriting

    Hi Amol

    please use code tages while posting codes its against the Forum rule, please edit your last post..

+ 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. Replies: 1
    Last Post: 12-03-2013, 04:19 AM
  2. Copying unprotected data from one sheet of workbook to another workbook
    By rushabh bhansali in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2013, 06:18 AM
  3. Replies: 8
    Last Post: 12-14-2012, 05:33 AM
  4. [SOLVED] Copying data from workbook/sheets to another workbook/sheet
    By yukon_phil in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-26-2006, 02:35 PM
  5. Copying a range from 1 sheet(workbook a)to another sheet(workbook b)
    By Irkiere in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-14-2005, 11:36 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