Consulting

Results 1 to 6 of 6

Thread: Summary worksheet

  1. #1
    VBAX Newbie
    Joined
    Jan 2007
    Posts
    4
    Location

    Summary worksheet

    I have workbooks that all have the same exact layout. Is there anyway to run a macro that will:

    1) Prompt user to select workbooks within a folder (not a specific one - I believe this is the GetOpenFilename command)
    2) Copy a range of values (for example A4 and C5:C28) from each worksheet within each workbook.
    3) Paste the copied range (A4 from first workbook would go in B1 with the range C5:C28 from first workbook would go in B2:B25). Information from second worksheet/workbook would go in C1 AND C2:C25. Information from third worksheet/workbook would go in D1 AND D225, etc etc until there are no more workbooks or worksheets.

    Essentially this is a summary worksheet...

  2. #2
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    Hi, there are limitations as Excel 2003 only has 256 columns so if you have more data than that you will not be able to achieve the format you require!

    As for the code to do what you want http://vbaexpress.com/kb/getarticle.php?kb_id=829 would be a good place to start, you should be able to add your own modifications to malik641's code.

    Regards,
    Simon
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  3. #3
    VBAX Newbie
    Joined
    Jan 2007
    Posts
    4
    Location
    Thanks for the help - one other thing...

    I get an error because some of the worksheets are protected. Is there a way to bring the info in and leave the sheets protected?

    Thanks!!!!!!

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You need to unprotect it, copy the data in, then protect it again.

  5. #5
    VBAX Contributor
    Joined
    Aug 2006
    Location
    Hampshire, UK
    Posts
    140
    Location
    Quote Originally Posted by xld
    You need to unprotect it, copy the data in, then protect it again.
    Although if you don't plan on saving the source workbook, you can skip the reprotect step.

    Bob, I have half a bottle of Sapphire that's looking definitely short-lived tonight!

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Too much work, nothing else to do

    Just send my portion over here, I've got the lemon, got a chilled glass, and I'm ready.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •