Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Changing rows

I have written a program to bring information from a file called 'US1' into a
file called 'CPWA'. US is 35,000 rows and information needs to move down one
row each time an "X" is identified in 'US1' column A. How do I get ImportRow
to equal one row down? ***** line does not work and this is where I need to
make a correction. This line is included for understanding only.

Here is what I have written to date:

Set ImportSht = Workbooks("CPWA.xls").Sheets("Import RRDD")
Set ImportRow = ImportSht.Range("A2")

With Workbooks("USD.txt").Sheets("USD")
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For RowCount = 1 To LastRow
If Range("A" & RowCount) = "X" Then
ImportRow.Value = Range("B" & RowCount).Value
ImportRow.Offset(0, 1).Value = Range("D" & (RowCount + 1)).Value
ImportRow.Offset(0, 2).Value = Range("E" & RowCount + 6).Value
ImportRow.Offset(0, 3).Value = Range("D" & RowCount + 8).Value
ImportRow.Offset(0, 4).Value = Range("C" & RowCount + 29).Value
ImportRow.Offset(0, 5).Value = Range("D" & RowCount + 29).Value
ImportRow.Offset(0, 6).Value = Range("E" & RowCount + 29).Value
ImportRow.Offset(0, 7).Value = Range("F" & RowCount + 29).Value
ImportRow.Offset(0, 8).Value = Range("G" & RowCount + 29).Value
********ImportRow = ImportRow + 1 ********
End If
Next RowCount

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Changing rows

Import row is a range object so to move it you need to set it to one row
below...

set ImportRow = importrow.offset(1,0)
--
HTH...

Jim Thomlinson


"iashorty" wrote:

I have written a program to bring information from a file called 'US1' into a
file called 'CPWA'. US is 35,000 rows and information needs to move down one
row each time an "X" is identified in 'US1' column A. How do I get ImportRow
to equal one row down? ***** line does not work and this is where I need to
make a correction. This line is included for understanding only.

Here is what I have written to date:

Set ImportSht = Workbooks("CPWA.xls").Sheets("Import RRDD")
Set ImportRow = ImportSht.Range("A2")

With Workbooks("USD.txt").Sheets("USD")
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For RowCount = 1 To LastRow
If Range("A" & RowCount) = "X" Then
ImportRow.Value = Range("B" & RowCount).Value
ImportRow.Offset(0, 1).Value = Range("D" & (RowCount + 1)).Value
ImportRow.Offset(0, 2).Value = Range("E" & RowCount + 6).Value
ImportRow.Offset(0, 3).Value = Range("D" & RowCount + 8).Value
ImportRow.Offset(0, 4).Value = Range("C" & RowCount + 29).Value
ImportRow.Offset(0, 5).Value = Range("D" & RowCount + 29).Value
ImportRow.Offset(0, 6).Value = Range("E" & RowCount + 29).Value
ImportRow.Offset(0, 7).Value = Range("F" & RowCount + 29).Value
ImportRow.Offset(0, 8).Value = Range("G" & RowCount + 29).Value
********ImportRow = ImportRow + 1 ********
End If
Next RowCount

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Changing rows

Perfect!!, thank you

"Jim Thomlinson" wrote:

Import row is a range object so to move it you need to set it to one row
below...

set ImportRow = importrow.offset(1,0)
--
HTH...

Jim Thomlinson


"iashorty" wrote:

I have written a program to bring information from a file called 'US1' into a
file called 'CPWA'. US is 35,000 rows and information needs to move down one
row each time an "X" is identified in 'US1' column A. How do I get ImportRow
to equal one row down? ***** line does not work and this is where I need to
make a correction. This line is included for understanding only.

Here is what I have written to date:

Set ImportSht = Workbooks("CPWA.xls").Sheets("Import RRDD")
Set ImportRow = ImportSht.Range("A2")

With Workbooks("USD.txt").Sheets("USD")
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For RowCount = 1 To LastRow
If Range("A" & RowCount) = "X" Then
ImportRow.Value = Range("B" & RowCount).Value
ImportRow.Offset(0, 1).Value = Range("D" & (RowCount + 1)).Value
ImportRow.Offset(0, 2).Value = Range("E" & RowCount + 6).Value
ImportRow.Offset(0, 3).Value = Range("D" & RowCount + 8).Value
ImportRow.Offset(0, 4).Value = Range("C" & RowCount + 29).Value
ImportRow.Offset(0, 5).Value = Range("D" & RowCount + 29).Value
ImportRow.Offset(0, 6).Value = Range("E" & RowCount + 29).Value
ImportRow.Offset(0, 7).Value = Range("F" & RowCount + 29).Value
ImportRow.Offset(0, 8).Value = Range("G" & RowCount + 29).Value
********ImportRow = ImportRow + 1 ********
End If
Next RowCount

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
Changing Columns to Rows MEAD5432 Excel Discussion (Misc queries) 3 October 31st 07 04:29 PM
Changing from Rows to Columns RayH Excel Discussion (Misc queries) 3 July 23rd 06 05:34 AM
Changing columns into rows Dave Excel Discussion (Misc queries) 3 April 5th 06 12:33 PM
Need help changing rows into columns wstaylor81 Excel Programming 4 December 9th 05 05:03 PM
Changing Columns to Rows jenbrunson Excel Discussion (Misc queries) 2 September 14th 05 03:31 PM


All times are GMT +1. The time now is 10:19 AM.

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"