PC Review


Reply
Thread Tools Rate Thread

Changing rows

 
 
iashorty
Guest
Posts: n/a
 
      24th Sep 2008
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 With Quote
 
 
 
 
Jim Thomlinson
Guest
Posts: n/a
 
      24th Sep 2008
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 With Quote
 
iashorty
Guest
Posts: n/a
 
      24th Sep 2008
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
FONT / ROW ACCESS 2007 Unable to change font size or colour of individual text or heigth of individual rows without all text & rows changing moto Microsoft Access 1 12th Nov 2008 07:23 PM
Add changing last rows Craig Schiller Microsoft Excel Discussion 8 24th Apr 2006 01:41 PM
Changing columns into rows =?Utf-8?B?RGF2ZQ==?= Microsoft Excel Misc 3 5th Apr 2006 12:33 PM
Changing Columns to Rows jenbrunson Microsoft Excel Misc 2 14th Sep 2005 03:31 PM
Changing the position of rows maysam Microsoft Excel Programming 4 15th Mar 2004 01:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:16 AM.