+ Reply to Thread
Results 1 to 5 of 5

VBA code summarizing sheets.

  1. #1
    Registered User
    Join Date
    08-06-2007
    Posts
    8

    VBA code summarizing sheets.

    Hello,

    I was given some help earlier from this geat forum. Of course I forgot to than whoever it was that helped me and provided me with some code (stressed as I am). If you happen to read this, thanks a bunch and sorry for being such a jerk.

    As great as the code was, it gave rise to a little problem. I uses a lookup function over multiple sheets (I understand that much...) but the problem is that when having two or more versions of the same workbook open, it summarizes from all of them. I'm guessing that there just needs to be a couple of words added for the module to just summarize the workbook that it is connected to (the same module appears in the new and the older version). Well here is the code:
    ____________________________________________

    Please Login or Register  to view this content.
    ____________________________________________
    (As I mentioned, this was given to me by somene on this board)

    If someone cold help me with this I would be very grateful and even remember to say thanks this time

    / Björn
    Last edited by VBA Noob; 10-03-2007 at 10:52 AM.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    consultantguy

    Please read forum rules & wrap your VBA code

    A thread with the rules is available at the top of each forum or see links below

    If you do not understand the VBA code wrap instructions have a look at my last reply in this thread
    http://www.excelforum.com/showthread.php?t=583950
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You need to be specific which workbook to summarise. Use ThisWorkbook for the workbook containing the code or ActiveWorkbook for the currently active workbook e.g.

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    08-06-2007
    Posts
    8
    mudraker: Sorry for that, I didn't know how to do that.

    royUK: Thanks, but it still summarizes from the older version of the workbook...

    To be a bit clearer:

    I have a sheet for summarizing the hours spent by a list of individuals. These appear in both versions of the workbook (the older and the new). The module posted above is also present in both versions.

    As other people are supposed to use the workbook and they may import transfer data from an older version to a new version of the workbook, I need to make it som that it only summarizes from the one sheet.

    Could the solution be to put the name of the workbook where it now says "ThisWorkBook"? Or to change the "sheets" in

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    ?

    I'm just guessing here...
    Last edited by consultantguy; 10-03-2007 at 09:20 AM.

  5. #5
    Registered User
    Join Date
    08-06-2007
    Posts
    8
    Maybe I'm not as dumb as I think or perhaps it was a lucky guess but anyways the latter of the alternatives I blurred out actually worked out! Thanks again royUK

+ 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