+ Reply to Thread
Results 1 to 7 of 7

Autosum

  1. #1
    Registered User
    Join Date
    03-09-2010
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007
    Posts
    35

    Question Autosum

    Okay guys, I'm stymied on this one. I've been working on creating an auto-reporting tool and I'm stuck.

    I have been working in a "scratchbook" (book4.xlsm) to ensure that I have proper coding before importing it into my final product.

    My line of code says to run the data table through a series of filters, autosum the results and then paste them into a cell on the summary page. Then, it resets the filters and runs the data through the process again, changing the filters and the output cell destination.

    In Book4.xlsm the macro works EXACTLY like it is supposed to. So, I copied the macro coding and pasted into the "reporting tool.xlsm". I included the lines to activate the "Monthly report.xls" and the correct sheet and select a cell in the data range. I even left the auto-refresh update ON so that I could see what's happening.

    Now, the coding does NOT work properly. it's EXACTLy the same code from book4, but it doesnt work. It's supposed to only be auto-summing the VISIBLE cells. But now, it's returning a random number. At first I thought that it was returning the results for ALL of column N, visible and hidden, but even that isnt the case. The results for Column N when auto-summed manually are "74918.28", however the macro is returning a result of "230144.65" and I cannot ascertain where that figure is coming from. Additionally, it's returing this same value for every single filter.

    I'm stuck. Please, please help!

    The code is below:

    ******************************************
    Please Login or Register  to view this content.
    (Truncated due to length)....all the rest is the same as above...
    Last edited by JohnathanC; 03-10-2010 at 04:37 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Autosum

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    I've added the tags this time,but be sure to read & follow the rules
    Last edited by royUK; 03-09-2010 at 03:33 PM.
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Autosum

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!

    Without seeing the data layout it's difficult, but probably a PivotTable would be better & more efficient, especially as your code is not written with efficiency in mind

  4. #4
    Registered User
    Join Date
    03-09-2010
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: Autosum

    Hi Roy,

    Sorry about the coding thing..I wasnt aware. I figured out my issue though, thanks.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Autosum

    Your post does not comply with Rule 9 of our Forum RULES. If you solve a problem yourself before anyone else has responded, please take a moment to describe your solution, chances are some other member will benefit. And please never edit a thread in which someone else has responded.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  6. #6
    Registered User
    Join Date
    03-09-2010
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: Autosum

    ? .... I didnt edit anything?

  7. #7
    Registered User
    Join Date
    03-09-2010
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: Autosum

    OKay then, as per "Rule 9", here was my solution.

    I had one workbook RUNNING the macro, and pasting the information into an "output" file. Here's what I wrote.

    Please Login or Register  to view this content.
    What ended up happening with that was that the file executing the code was autosumming the data in the range in that workbook instead of the range of the output file.

    The problem was here:

    Please Login or Register  to view this content.
    Since I had "activated" the output file earlier in the code I changed the code to this:

    Please Login or Register  to view this content.
    and Bob's your uncle.

+ 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