Solved

Excel - Auto-Create Journal Entries

Posted on 2016-08-24
1
72 Views
Last Modified: 2016-08-28
Hi,

I have an external table that I would like to download to excel each month and then create journal entries.  The rows on the external file vary per month.  I would like to set this up so I'm not having to copy/paste or creating new formulas each month.  Below is an example of the external table and what I would like the end result to look like.  .  Please let me know if this is possible.

'Before'
Batch      Amount      Date
11568      100         6/30/2016
11475      50          6/30/2016
11837      300              6/30/2016

'After'
Batch      Amount      Date      Type
11568      100      6/30/2016      Debit
11475      50      6/30/2016      Debit
11837      300      6/30/2016      Debit
11568      100      6/30/2016      Credit
11475      50      6/30/2016      Credit
11837      300      6/30/2016      Credit
0
Comment
Question by:Wonderwall99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 30

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 500 total points
ID: 41769295
Please try this....

In the attached, click the button on Sheet1 to create Journal.
Sub CreateJournal()
Dim sws As Worksheet, dws As Worksheet
Dim slr As Long, rng As Range
Application.ScreenUpdating = False
Set sws = Sheets("Sheet1")
slr = sws.Cells(Rows.Count, 1).End(xlUp).Row
Set rng = sws.Range("A2:C" & slr)
On Error Resume Next
Set dws = Sheets("Journal")
dws.Cells.Clear
On Error GoTo 0
If dws Is Nothing Then
   Sheets.Add(before:=Sheets(1)).Name = "Journal"
   Set dws = ActiveSheet
End If
dws.Range("A1:D1").Value = Array("Batch", "Amount", "Date", "Type")
rng.Copy dws.Range("A2")
dws.Range("D2:D" & slr).Value = "Debit"
rng.Copy
dws.Range("A" & Rows.Count).End(3)(2).PasteSpecial xlPasteAll
dws.Range("D2:D" & (slr * 2) - 1).SpecialCells(xlCellTypeBlanks).Value = "Credit"
dws.Columns.AutoFit
dws.Range("A1").CurrentRegion.Borders.Color = vbBlack
dws.Activate
dws.Range("A1").Select
Application.ScreenUpdating = True
End Sub

Open in new window

CreateJournal.xlsm
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question