Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Script out of range
Hi.. well i'm back again.. this glitch is more than I can figure out... The
macro seems to be putting the information in only "one" column... the information that needs to be inserted is going down to the 5th row in Column D and putting "all" of the information there, instead of placing each row to the right of Column D. Does that make sense? Thanks, J |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Script out of range
Post your code for better response to your problem.
"J" wrote: Hi.. well i'm back again.. this glitch is more than I can figure out... The macro seems to be putting the information in only "one" column... the information that needs to be inserted is going down to the 5th row in Column D and putting "all" of the information there, instead of placing each row to the right of Column D. Does that make sense? Thanks, J |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Script out of range
Here's the code... Thanks,
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 Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub This is how it imports: First Name Last Name B2 - H.T.A. Offence A1 - Date Retained AA-TAD:0-2: 1st. AMT AA-TAD:0-3:PMT Method AA-TAD:0-4:Receipt # Frank Hiller Stunt--Speeding 02-Jan-08 100 Cash cash jane doe Speeding 30 To 49 over 14-Feb-08 50 Cheque 23232 Ashley Brown Speeding 0 to 15 over 04-Mar-08 100 Cheque A4545 And this is how I need it to look: First Name Last Name B2 - H.T.A. Offence A1 - Date Retained AA-TAD:0-2: 1st. AMT AA-TAD:0-3:PMT Method AA-TAD:0-4:Receipt # Frank Hiller Stunt--Speeding 02-Jan-08 100 Cash cash 19-Feb-08 50 Cash cash 06-Mar-08 100 Cash cash 02-Apr-08 117.5 Cash cash Ashley Brown Speeding 0 to 15 over 04-Mar-08 100 Cheque A4545 04-Feb-08 150 Debit CIBC 456 28-Feb-08 75 Cheque CIBC 78 21-Mar-08 42.5 Cheque CIBC 88 Thanks, J "JLGWhiz" wrote: Post your code for better response to your problem. "J" wrote: Hi.. well i'm back again.. this glitch is more than I can figure out... The macro seems to be putting the information in only "one" column... the information that needs to be inserted is going down to the 5th row in Column D and putting "all" of the information there, instead of placing each row to the right of Column D. Does that make sense? Thanks, J |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Script out of range
I found your previous posting. This line:
Destination:=.Cells(X - 9 + DataRow + Z, MoveToColumn) Tells VBA to put everything in column D. MoveToColumn = 4 which = D. To move it to the right of column D, you will either need to change the value of MoveToColumn or add another value to it in the statement above. "J" wrote: Hi.. well i'm back again.. this glitch is more than I can figure out... The macro seems to be putting the information in only "one" column... the information that needs to be inserted is going down to the 5th row in Column D and putting "all" of the information there, instead of placing each row to the right of Column D. Does that make sense? Thanks, J |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Script out of range | Excel Programming | |||
Range Syntax for Script | Excel Programming | |||
Adjusting the range of a script | Excel Programming | |||
sub script out of range problem | Excel Programming | |||
Script out of range error | Excel Programming |