Creating an "insert" macro

monaleasa001
04-14-2008, 10:15 AM
need to create a macro that will move information from a range of columns and then insert them under existing information in another column.

here's my example, this is what I'm starting with:

There are only 3 rows in this worksheet and I have numbered the columns just for reference in solving this problem: Anyway, this is how it looks when I import the records:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
First Last Offence Retained 1st. AMT PMT Method Receipt # Bal Fwd Date AMT Pmt Method Receipt # Bal Fwd Date AMT Pmt Method Receipt # Bal Fwd Date AMT Pmt Method Receipt # Bal Fwd
Ashley Brown Speeding 0 to 15 over 04-Mar-08 100 Cheque A4545 267.5 #### 150 Debit CIBC 456 118 #### 75 Cheque CIBC 78 43 ######## 43 Cheque CIBC 88 0
Frank Hiller Stunt--Speeding 02-Jan-08 100 Cash cash 267.5 #### 50 Cash cash 218 #### 100 Cash cash ## 02-Apr-08 118 Cash cash 0
jane doe Speeding 30 To 49 over 14-Feb-08 50 Cheque 23232 317.5 #### 50 Cheque TD 023 268 #### 100 Cheque td32 ## ######## 168 Cheque td35 0



And this is how I need it to look after the information is moved and re-inserted:

1 2 3 4 5 6 7 8
First Last Offence Date 1st. AMT PMT Method Receipt # Bal Fwd
Frank Hiller Stunt--Speeding 02-Jan-08 100 Cash cash 267.5



19-Feb-08 50 Cash cash 217.5



06-Mar-08 100 Cash cash 117.5



02-Apr-08 117.5 Cash cash 0
jane doe Speeding 30 To 49 over 14-Feb-08 50 Cheque 23232 317.5



14-Feb-08 50 Cheque TD 023 267.5



20-Feb-08 100 Cheque td32 167.5



10-Mar-08 167.5 Cheque td35 0
Ashley Brown Speeding 0 to 15 over 04-Mar-08 100 Cheque A4545 267.5



04-Feb-08 150 Debit CIBC 456 117.5



28-Feb-08 75 Cheque CIBC 78 42.5


Also, There will only be 3 entries for each client.
This is a copy of the macro that I have so far:

Sub MoveRow2Data()
Dim X As Long, Z As Long
Dim LastColumn As Long
Const StartCol As Long = 9
Const GroupCount As Long = 5
Const MoveToColumn As Long = 4
Const DataRow As Long = 2
With Worksheets("TrustDepositCSVfile")
LastColumn = .Cells(DataRow, .Columns.Count).End(xlToLeft).Column
For X = StartCol To LastColumn Step 5
For Z = 0 To GroupCount - 1
.Cells(DataRow, X + Z).Copy _
Destination:=.Cells(X - 9 + DataRow + Z, MoveToColumn)
Next
Next
.Cells(DataRow, StartCol).Resize(1, LastColumn - _
StartCol + 1).ClearContents
End With
End Sub


Can anyone help me create this macro? Thanks, Monaleasa

dcbasic
04-15-2008, 12:42 AM
I think this is in the wrong forum.

MPi
04-15-2008, 03:34 PM
Welcome on the forum monaleasa001,

It's pretty hard to understand how the sheet is displayed... The text you entered is not very well formated...

Is it possible for you to put a picture of the data to make it easier to decrypt ?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum