+ Reply to Thread
Results 1 to 13 of 13

Excel VBA Loop to Format General Ledger

  1. #1
    Registered User
    Join Date
    07-08-2017
    Location
    Minnesota
    MS-Off Ver
    Microsoft Office 2016
    Posts
    74

    Excel VBA Loop to Format General Ledger

    Hello,

    In the attached workbook, I am trying to take the sheet "GL Format 1" and turn it into the format of "GL Format 2" through a macro. I am not sure how I can do this because the number of lines will vary for each account based off how much activity (increased or decreased) and this will affect where formatting goes. Can anyone please help with formatting all of "GL Format 1" into "GL Format 2" with a macro? I need each account to have all activity for the period in it, i.e., 201701-201706 activity for account 1012-000 would be 22 lines long when formatted into "GL Format 2" with a total of $(422.01). I included some activity for 2 accounts on "GL Format 2" for a reference on the format needed.

    Any help on this would be GREATLY appreciated! Thank you!
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,519

    Re: Excel VBA Loop to Format General Ledger

    Try
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Excel VBA Loop to Format General Ledger

    Hi Hoover

    I can get very close to your answer using Pivot Tables. You will need to learn a bit more about Pivots and formats and subtotals along with Expand or Collapse rows. See what I've done in the attached. Note the Filter above the pivot, getting closer to your example. I hope this gives you some ideas. Note - No VBA needed for Pivots.

    PT instead of GL Macro.xlsm
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    07-08-2017
    Location
    Minnesota
    MS-Off Ver
    Microsoft Office 2016
    Posts
    74

    Re: Excel VBA Loop to Format General Ledger

    Hi Jindon,

    It looks like it worked, but only for the 201701 period and not all periods, so it would need some sort of code to grab all Periods listed. Also I need the macro to do a Total of each account two rows below the last line item for each account, i.e., Total of H:H in cell H9 for 1012-000, total in cell H27 for 1110-000 and so on, but the placement of the the Total will vary each time. I saved a new workbook and highlighted the differences in yellow from "Sheet1" to "GL Format 2" to show you the difference.

    Thank you

  5. #5
    Registered User
    Join Date
    07-08-2017
    Location
    Minnesota
    MS-Off Ver
    Microsoft Office 2016
    Posts
    74

    Re: Excel VBA Loop to Format General Ledger

    Forgot to add workbook. Here it is.
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,519

    Re: Excel VBA Loop to Format General Ledger

    Quote Originally Posted by Hoover5896 View Post
    Hi Jindon,

    It looks like it worked, but only for the 201701 period and not all periods, so it would need some sort of code to grab all Periods listed.
    It should list all and I see in the result.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-08-2017
    Location
    Minnesota
    MS-Off Ver
    Microsoft Office 2016
    Posts
    74

    Re: Excel VBA Loop to Format General Ledger

    It looks like the code got the total added, but the period is still only coming out to be 201701 instead of all activity (201701-201712 so new data can be dropped in) As of now the workbook only has 201701-201706 though.
    Attached Files Attached Files

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,519

    Re: Excel VBA Loop to Format General Ledger

    Where did row 9 of "GL Format 2" that is the period of "2452/3/28" come from?

    There's no such data in "GL Format 1".

  9. #9
    Registered User
    Join Date
    07-08-2017
    Location
    Minnesota
    MS-Off Ver
    Microsoft Office 2016
    Posts
    74

    Re: Excel VBA Loop to Format General Ledger

    I think that was my typo. I now see it is showing all periods, my apologies. I meant I need to have each account have each period in it. So instead of each account being displayed multiple times in GL Format 2, it should just have one account for each account and then all periods under each account
    Attached Files Attached Files
    Last edited by Hoover5896; 07-17-2017 at 03:12 PM. Reason: Additional information

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,519

    Re: Excel VBA Loop to Format General Ledger

    I'm totally lost.

    I don't understand the difference between what you are asking and the last code I have posted.

  11. #11
    Registered User
    Join Date
    07-08-2017
    Location
    Minnesota
    MS-Off Ver
    Microsoft Office 2016
    Posts
    74

    Re: Excel VBA Loop to Format General Ledger

    I attached another workbook to show the difference. Example being account 1012-000 showing up 7 times each for a different period and this is happening for all accounts, whereas this account should just be listed once with all seven periods worth of activity under it. That way there is only 1 account being listed no matter how many periods get added.

    I made 2 tabs to show the difference between the "Current Macro" and what I am needing listed as "All Periods Under One Account" tab.

    Thanks for your patience on this!
    Attached Files Attached Files

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,519

    Re: Excel VBA Loop to Format General Ledger

    Change to
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    07-08-2017
    Location
    Minnesota
    MS-Off Ver
    Microsoft Office 2016
    Posts
    74

    Re: Excel VBA Loop to Format General Ledger

    This is perfect!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Automated Accounting System in posting to General Ledger from General Journal
    By Angelika_D15 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-31-2016, 02:08 AM
  2. Link a General Journal to General Ledger Debit or Credit balance
    By detoge in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 11-22-2015, 09:49 PM
  3. How to create General Ledger in Excel with or without VBA
    By SVongdara in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-17-2014, 10:03 AM
  4. General Ledger Formulas
    By Cybermaus in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-09-2013, 02:02 PM
  5. Sample general ledger
    By Paul Morgan in forum Excel General
    Replies: 3
    Last Post: 04-30-2007, 09:48 AM
  6. [SOLVED] Is there a general excel small business ledger/journal template?
    By Andy H in forum Excel General
    Replies: 1
    Last Post: 03-20-2006, 01:30 PM
  7. [SOLVED] Excel General Ledger
    By Ted in forum Excel General
    Replies: 2
    Last Post: 04-07-2005, 09:06 PM

Tags for this Thread

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