+ Reply to Thread
Results 1 to 5 of 5

Excel macro to search a particular workbook and copy data to consolidated

  1. #1
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Pune
    MS-Off Ver
    Office 365 (Win 10)
    Posts
    489

    Excel macro to search a particular workbook and copy data to consolidated

    Hi,
    I searched a lot to find the answer here, but not able to. So asking here. Forgive me if already asked

    What i basically need is a macro to get the days from a work book and save it in another

    The conditions are

    The consolidated report and the source will be on same folder
    I want to search a sheet named xyz in the work book named ABC on that folder.

    The structure of both the sheet will be same...

    Any help please...

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Excel macro to search a particular workbook and copy data to consolidated

    Something along these lines perhaps?

    Please Login or Register  to view this content.
    Change folder and range to suit your needs.

    Alf

  3. #3
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Pune
    MS-Off Ver
    Office 365 (Win 10)
    Posts
    489

    Re: Excel macro to search a particular workbook and copy data to consolidated

    Thanks for the help. I got another macro from this site itself and after combining that and yours, I got my perfect macro
    But not able to put here because I am not able to open the site using desktop.
    This is from mobile.

    I will update it as soon as I get the site writhing in my computer also. Thanks.....

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Excel macro to search a particular workbook and copy data to consolidated

    Glad to hear that your problem seems solved. Could you then mark your thread "Solved" according to Forum rules.

    Alf

    To mark your thread solved do the following:
    - Go to the first post
    - Click edit
    - Click Advance
    - Just below the word "Title:" you will see a dropdown with the word No prefix.
    - Change to Solve
    - Click Save

  5. #5
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Pune
    MS-Off Ver
    Office 365 (Win 10)
    Posts
    489

    Re: Excel macro to search a particular workbook and copy data to consolidated

    Hi,
    Here is my final Code.....
    PHP Code: 
    Sub openAndCopy_CTT()
        
    Dim wbCopy As Workbook
        Dim wsCopy 
    As Worksheet
        Dim rngCopy 
    As Range
        Dim wbPaste 
    As Workbook
        Dim wsPaste 
    As Worksheet
        Dim rngPaste 
    As Range
        
        Set wbCopy 
    Workbooks.Open(ThisWorkbook.Path "\R.000_CTT_MSR.xlsx")    'change path
        Set wsCopy = wbCopy.Worksheets("Consolidated")
        Set rngCopy = wsCopy.Range("a:o").EntireColumn
        Set wbPaste = Workbooks("New Consolidated MSR.xlsm")
        Set wsPaste = wbPaste.Worksheets("CTT")  '
    paste to different sheet?
        
    Set rngPaste wsPaste.Range("a1")  'change this if needed
        
        rngCopy.Copy
        rngPaste.PasteSpecial xlPasteValues
        Application.CutCopyMode = False
        Workbooks("R.000_CTT_MSR.xlsx").Close SaveChanges:=False
        


    End Sub 

+ Reply to Thread

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