+ Reply to Thread
Results 1 to 23 of 23

Macro Help with Pasting Formula Values

  1. #1
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Macro Help with Pasting Formula Values

    Right now the macro will find the high value in column E and subtract it with a value in Column B2-B7 until each cell from B2-B7 reaches 0. I wanted to paste these subtractions into Column G. I also wanted to paste the categories it came from so I could use them for the 2nd part of my project.

    I have tired numerous different things but can't get anything to seem to record each subtraction in column G. I was going to paste the category for each subtraction also in columns H and I.

    So for instance a credit card subtracting from textbooks would show the amount in G that was subtracted then in H say credit card and I would say textbooks.

    Any help would be appreciated.

    Thanks
    Attached Files Attached Files
    Last edited by carden2; 09-19-2012 at 02:41 PM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Macro Help with Pasting Formula Values

    carden2,

    Attached is a modified version of your posted workbook.
    I removed the existing macros and replaced them with this one:
    Please Login or Register  to view this content.

    Is something like that what you're looking for?
    Attached Files Attached Files
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Macro Help with Pasting Formula Values

    Wow thanks. It's really close. I changed the range to B3-B7 I want to leave cash deposits. The categories seem to get mixed up some as well. The categories in column A should show in column G only and column D categories in column J only. I think with that change I can figure out the difference in each subtraction so each subtraction made should all be in the same row.

    like the category A/before amount/after amount then category D/before amount/after amount
    Last edited by carden2; 09-13-2012 at 04:47 PM.

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Macro Help with Pasting Formula Values

    carden2,

    Updated code and attachment:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Macro Help with Pasting Formula Values

    Perfect. Thank you very much for the help.

    I was wondering if you could explain your code a little to me if you would. Are you making a data array of numbers?

  6. #6
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Macro Help with Pasting Formula Values

    Same code with comments. Hopefully this helps explain what is going on and why:
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Macro Help with Pasting Formula Values

    I guess I have one last step. I got the suggestions here implemented and it's working great. I appreciate the documentation as well. This part I wasn't told but I can't figure out as well. I worked on it most the day friday. I need to run the macro and then the remaining amounts left in column E should also go to the side where the account# goes to Credit and the Amount goes to before and after amount. I tried to use the coe I was helped with but had some trouble and I don't want to ruin what has been done so far.

  8. #8
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Macro Help with Pasting Formula Values

    Can you provide a sample of desired results with the new requirements?

  9. #9
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Macro Help with Pasting Formula Values

    Hopefully this makes sense. I attached the most updated version I have that I am working on I filled in the data so you can go to the bookstore tab and click run macro. This does the subtraction code that you wrote. It will run first then after it runs I need it to move the remaining values from column F to column M and the associated Account# with column F would go in Column J under credit.

    After that it needs to move any cell in column F that still has a value to the side. There's no subtracting or any more math involved. Just find the cells in column F and move them to column M and move the associated account# with the amount from column E to column J.

    After that I click make Bookstore JE and it goes to a tab where it pulls in the information from the bookstore tab so I can eventually create a text file. I need to have description filled in but I think I can get that part. Also the reference numbers will fill in if you put in a reference # in cell B16.

    I hope this makes sense.
    Attached Files Attached Files

  10. #10
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Macro Help with Pasting Formula Values

    carden2,

    Attached is a modified version of your provided workbook. The code for mathstuff has been updated to the following:
    Please Login or Register  to view this content.


    Is that what you're looking for?
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Macro Help with Pasting Formula Values

    Yes that works perfect. Thanks. You've been the most amazing help.

    I do have one other question. Why won't access let you begin numbers with 0? It always gives an error and I have to ignore error. Is there a way around this so you can start a number with 0?

  12. #12
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Macro Help with Pasting Formula Values

    Access should let you start numbers with 0, it will just remove leading 0's unless you set a Format, such as 000 which will show the number 1 as 001, the number 12 as 012, and the number 123 as simply 123. However, if you having an issue with Access, you should start a new thread for that question. While I am familiar with Access, I am by no means an expert.

  13. #13
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Macro Help with Pasting Formula Values

    Thanks for the advice I'll have to make the format then. I'll mark the thread as solved.

  14. #14
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Macro Help with Pasting Formula Values

    I am back with one more issue I am needing help with. I finally got it tested out today. I've worked quite a bit on it getting it to reset everything and create a text file. It works great.

    The issue I am needing help with now is dealing with negative numbers. A negative number in Column C will just be added to an amount in column F and documented in columns G:M much like when subtracting. The only difference is with the negative numbers the account numbers will be switched. Also a negative amount in column F will be moved to column G,J,M much like the other remaining amounts. The other tricky part about negative numbers is the account numbers will be reversed where the debit# will go in the credit column and vice versa.

    I attached my example and any help will be appreciated.

    Thanks.
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Macro Help with Pasting Formula Values

    anyone have any ideas on this?

    Thanks.

  16. #16
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Macro Help with Pasting Formula Values

    anyone have any suggestions?

    Thanks.

  17. #17
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Macro Help with Pasting Formula Values

    With that most recent example file you posted, can you provide a page of the results you're currently getting, and then another page of the results you want to be getting?

  18. #18
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Macro Help with Pasting Formula Values

    Yes give me about 15-20 minutes and I'll it up. Thanks.

  19. #19
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Macro Help with Pasting Formula Values

    Alright I made up some examples Before is what I get now with some explanations in it then the example file shows what it should be getting. I hope this helps I really appreciate the help on this.
    Attached Files Attached Files

  20. #20
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Macro Help with Pasting Formula Values

    Unfortunately I don't have time to go into this very much today, but I'll definitely have a go at it tomorrow, sorry for the delay. Work has been crazy ><

  21. #21
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Macro Help with Pasting Formula Values

    Quote Originally Posted by tigeravatar View Post
    Unfortunately I don't have time to go into this very much today, but I'll definitely have a go at it tomorrow, sorry for the delay. Work has been crazy ><
    I know how that is I just appreciate all your effort helping me out with this. I've worked on it for about 2 weeks now it's 1 part to generate a text file while I have almost finished the other part. I look forward to seeing what you come up with. Thanks.

  22. #22
    Forum Contributor
    Join Date
    06-18-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Macro Help with Pasting Formula Values

    Any ideas on this?

  23. #23
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Macro Help with Pasting Formula Values

    Its been a hard week at work, and my brain is fried

    Why don't all the rows have before/after amounts? I see the Debit Account 0400001116, but why is that being pulled? It doesn't have an amount and is after the C column total. This looks like a different enough macro you should probably start a new thread. You'll get more visibility with a new thread also.

+ 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