Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
j j is offline
external usenet poster
 
Posts: 128
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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   Report Post  
Posted to microsoft.public.excel.programming
j j is offline
external usenet poster
 
Posts: 128
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Script out of range J Excel Programming 7 April 11th 08 10:09 PM
Range Syntax for Script [email protected] Excel Programming 3 June 21st 07 06:34 PM
Adjusting the range of a script jsd219 Excel Programming 0 October 31st 06 07:56 PM
sub script out of range problem AmyTaylor[_20_] Excel Programming 5 July 27th 05 12:17 AM
Script out of range error [email protected] Excel Programming 5 May 24th 05 09:37 PM


All times are GMT +1. The time now is 07:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"