Solved

Excel - Auto-Create Journal Entries

Posted on 2016-08-24
1
41 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
1 Comment
 
LVL 28

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now