Results 1 to 5 of 5

VBA code summarizing sheets.

Threaded View

  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:
    ____________________________________________

     Function MySumproduct(Nme As String)
      Dim WrkSH As Worksheet
      holder = 0
      For i = 3 To Worksheets.Count - 3
        Set WrkSH = Sheets(i)
        holder = holder + WorksheetFunction.SumIf(WrkSH.Range("A:A"), Nme, WrkSH.Range("B:B"))
      Next i
      MySumproduct = holder
    End Function
    ____________________________________________
    (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.

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