VinodKrishnappa

New Member
Joined
Aug 6, 2016
Messages
31
Hi...
I required little help in making an entry employee wise with the data available.

In a file, I'll be having 2 sheets DATA & ENTRY. I should use the DATA to make available of the ENTRY individual employee wise.

DATA Sheet

DIMENTION PART 2 - TEXTSDIMENSION PART 1 - LEDGER CODES
EMPLOYEE NONAMEBRANCHBUSINESS UNITDEPARTMENTEMPNOPROJECTSEGMENT431208132011142014142020131401142010142017251301132001431208431208132025
111000Mr. ADELGeneralHRM111000PROJ1DSP31,1002001,800001,2700000027,830
111001Mr. BPUNGeneralACC111001PROJ2GES31,2002001,80004660010000028,734
111002Ms. CDELGeneralFCA111002PROJ1GEN27,4002001,800002330000025,167
Amount
Dr.Cr.Cr.Cr.Cr.Cr.Cr.Cr.Cr.Cr.Cr.Cr.

<colgroup><col><col><col span="6"><col span="12"></colgroup><tbody>
</tbody>



Entry Sheet

DRCRDIMENSION
31100431208.DEL.General.HRM.111000.PROJ1.DSP
200132011.DEL.General.HRM.111000.PROJ1.DSP
1800142014.DEL.General.HRM.111000.PROJ1.DSP
1270132036.DEL.General.HRM.111000.PROJ1.DSP
27830132025.DEL.General.HRM.111000.PROJ1.DSP
31200431208.PUN.General.ACC.111001.PROJ2.GES
200132011.PUN.General.ACC.111001.PROJ2.GES
1800142014.PUN.General.ACC.111001.PROJ2.GES
466131401.PUN.General.ACC.111001.PROJ2.GES
100251301.PUN.General.ACC.111001.PROJ2.GES
28734132025.PUN.General.ACC.111001.PROJ2.GES
27400431208.DEL.General.FCA.111002.PROJ1.GEN
200132011.DEL.General.FCA.111002.PROJ1.GEN
1800142014.DEL.General.FCA.111002.PROJ1.GEN
233142010.DEL.General.FCA.111002.PROJ1.GEN
25167132025.DEL.General.FCA.111002.PROJ1.GEN

<colgroup><col span="2"><col></colgroup><tbody>
</tbody>


Now in ENTRY sheet Dr. (Column A) & Cr. (Column B) will consist the amount of the individual employees line by line in a transpose way which comes from DATA.

Next to this we'll have Dimension (Column C) which consist the dimension of individual line item details as available in DATA sheet. The Format of the Dimension is mentioned in DATA Sheet for reference.

DIMENSION FORMAT
LEDGERCODE.BRANCH.BUSINESSUNIT.DEPARTMENT.EMPNO.PROJECT.SEGMENT
Dimension Part 1Dimension Part 2
LEDGERCODE.BRANCH.BUSINESSUNIT.DEPARTMENT.EMPNO.PROJECT.SEGMENT

<colgroup><col span="6"><col span="3"></colgroup><tbody>
</tbody>


Now in my requirement i need entry in ENTRY SHEET for all the employees from DATA sheet in a automated process. I'll be handling this for 1000 line items.

Please do the needful.
Thanks in advance.
VK
 
Last edited:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Book1
ABCDEFGHIJKLMNOPQRST
1DIMENSION PART 2 - TEXTSDIMENSION PART 1 - LEDGER CODES
2EMPLOYEE NONAMEBRANCHBUSINESS UNITDEPARTMENTEMPNOPROJECTSEGMENT431208132011142014142020131401142010132017251301132001321208431208132025
3111000Mr. ADELGeneralHRM111000PROJ1DSP3110020018000012700000027830
4111001Mr. BPUNGeneralACC111001PROJ2GES31200200180004660010000028734
5111002Mr. CDELGeneralFCA111002PROJ1GEN274002001800002330000025167
DATA



Book1
ABC
1DRCRDIMENSION
231100431208.DEL.General.HRM.111000.PROJ1.DSP
3200132011.DEL.General.HRM.111000.PROJ1.DSP
41800142014.DEL.General.HRM.111000.PROJ1.DSP
51270142010.DEL.General.HRM.111000.PROJ1.DSP
627830132025.DEL.General.HRM.111000.PROJ1.DSP
731200431208.PUN.General.ACC.111001.PROJ2.GES
8200132011.PUN.General.ACC.111001.PROJ2.GES
91800142014.PUN.General.ACC.111001.PROJ2.GES
10466131401.PUN.General.ACC.111001.PROJ2.GES
11100251301.PUN.General.ACC.111001.PROJ2.GES
1228734132025.PUN.General.ACC.111001.PROJ2.GES
1327400431208.DEL.General.FCA.111002.PROJ1.GEN
14200132011.DEL.General.FCA.111002.PROJ1.GEN
151800142014.DEL.General.FCA.111002.PROJ1.GEN
16233142010.DEL.General.FCA.111002.PROJ1.GEN
1725167132025.DEL.General.FCA.111002.PROJ1.GEN
ENTRY


Code:
Private Const HEADER_ROW = 2 ' Make this the row on the DATA sheet that contains the headers
Public Sub DataEntryWithDimension()

Dim wsData As Worksheet
Dim wsEntry As Worksheet
Dim lastRow As Long
Dim thisRow As Long
Dim lastCol As Long
Dim thisCol As Long
Dim nextRow As Long
Dim nextCol As Long
Dim dimensionParts(5) As Variant
Dim headerRange As Range
Dim dimensionString As String
Dim i As Long

' Get handles to the sheets
Set wsData = Worksheets("DATA")
Set wsEntry = Worksheets("ENTRY")

' Find the last row as column on the data sheet
lastRow = wsData.Cells(wsData.Rows.Count, 1).End(xlUp).Row
lastCol = wsData.Cells(HEADER_ROW, wsData.Columns.Count).End(xlToLeft).Column

' Set up the header range
Set headerRange = wsData.Range(wsData.Cells(HEADER_ROW, 1), wsData.Cells(HEADER_ROW, lastCol))

' Find the column headers for each constituent of the dimension
dimensionParts(0) = Application.Match("BRANCH", headerRange, 0)
dimensionParts(1) = Application.Match("BUSINESS UNIT", headerRange, 0)
dimensionParts(2) = Application.Match("DEPARTMENT", headerRange, 0)
dimensionParts(3) = Application.Match("EMPNO", headerRange, 0)
dimensionParts(4) = Application.Match("PROJECT", headerRange, 0)
dimensionParts(5) = Application.Match("SEGMENT", headerRange, 0)

' Find the next row on the entry sheet
nextRow = wsEntry.Cells(wsEntry.Rows.Count, 3).End(xlUp).Row + 1

' Process all rows on the data sheet
For thisRow = HEADER_ROW + 1 To lastRow
    ' This is the next column we'll fill on the entry sheet
    nextCol = 1
    
    ' Process all columns to the right of "SEGMENT" on the data sheet
    For thisCol = dimensionParts(5) + 1 To lastCol
        ' If this is a non-zero amount
        If wsData.Cells(thisRow, thisCol).Value > 0 Then
            ' Construct the dimension string from the appropriate columns
            dimensionString = CStr(wsData.Cells(HEADER_ROW, thisCol).Value)
            For i = 0 To 5
                dimensionString = dimensionString & "." & CStr(wsData.Cells(thisRow, dimensionParts(i)).Value)
            Next i
            
            ' Put the values into the next row
            wsEntry.Cells(nextRow, 3).Value = dimensionString
            wsEntry.Cells(nextRow, nextCol).Value = wsData.Cells(thisRow, thisCol).Value
            
            ' Move the next column to the right if necessary
            If nextCol < 2 Then nextCol = 2
            
            ' Move to the next row
            nextRow = nextRow + 1
        End If
    Next thisCol
Next thisRow

End Sub

WBD
 
Upvote 0
maintenance wise, this is going to get missy as the data increases. 1000 lines of formula wooot.. You should consider redesigning your spreadsheet. just my opinion. anyway im on the challenge. :)

WBD already had a solution for you, im abandoning mine now. good luck bro.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,200
Messages
6,123,611
Members
449,109
Latest member
Sebas8956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top