+ Reply to Thread
Results 1 to 9 of 9

VBA to summerize the workbook sheets data in a required structure

  1. #1
    Registered User
    Join Date
    05-21-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    75

    Post VBA to summerize the workbook sheets data in a required structure

    Hi All,

    Please check the attached workbook.

    It contains how the data existed in different sheets which i need to summarize in a separate sheet.

    I have prepared the data structure how i required manually in the sheet "FinalResult" for your reference.

    can you please help me how can i achieve this using VBA code.

    Thanks in advance

    Regards
    kumar
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,164

    Re: VBA to summerize the workbook sheets data in a required structure

    Try this code
    Please Login or Register  to view this content.
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose View | Macros
    Select a macro in the list, and click the Run button
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA to summerize the workbook sheets data in a required structure

    Added a Sheet "Test Final" so you can check against your final result to see if that's what you want.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    05-21-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    75

    Post Re: VBA to summerize the workbook sheets data in a required structure

    Hi Arlu,

    Thanks for the code and it is working for me.

    A small extension is needed for me.

    Can you please tell me how can i repeat the loop if i had multiple years of data in each sheet.

    Please check the attached file.


    Regards
    Kumar
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,164

    Re: VBA to summerize the workbook sheets data in a required structure

    Try this
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-21-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: VBA to summerize the workbook sheets data in a required structure

    Arlu,

    Thanks for your time on this post.

    can we execute this macro from another workbook and get the data from the original like how you are doing now?


    Regards
    Kumar

  7. #7
    Registered User
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,164

    Re: VBA to summerize the workbook sheets data in a required structure

    As long as you keep the macro file and the data file open, you should be able to run the macro on the data file.

  8. #8
    Registered User
    Join Date
    05-21-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: VBA to summerize the workbook sheets data in a required structure

    Arlu,

    That means,

    We can run the macro in datfaile only but we can get the "Output" data in another file/Workbook.

    is this you are saying?

    Regards
    Kumar

  9. #9
    Registered User
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,164

    Re: VBA to summerize the workbook sheets data in a required structure

    No, what i meant is, you can have the macro in workbook1 and run it on data in workbook2 as long as the sheets in workbook2 are named exactly as the macro. Ensure that both workbooks are open at the time of running the macro.

+ 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