Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default VBA, change 'copy line' into 'copy range'

Hi all,

Can someone advice me how to modify the following code to copy a line
from column A:U instead of the whole line?

Dim iLastRow As Long, iNextRow As Long
Dim i As Long
With Worksheets("Positions")
iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
If .Cells(i, "A").Value = "RNWD" Then
iNextRow = iNextRow + 1
.Rows(i).Cut _
Worksheets("Futures").Cells(iNextRow, "A")
End If
Next i
End With


Thanks a lot!

Rgds,
Robert

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default VBA, change 'copy line' into 'copy range'

Dim iLastRow As Long, iNextRow As Long
Dim i As Long
With Worksheets("Positions")
iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
If .Cells(i, "A").Value = "RNWD" Then
iNextRow = iNextRow + 1
.Cells(i, "A").Resize(,21).Cut _
Worksheets("Futures").Cells(iNextRow, "A")
End If
Next i
End With



--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Robert" wrote in message
oups.com...
Hi all,

Can someone advice me how to modify the following code to copy a line
from column A:U instead of the whole line?

Dim iLastRow As Long, iNextRow As Long
Dim i As Long
With Worksheets("Positions")
iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
If .Cells(i, "A").Value = "RNWD" Then
iNextRow = iNextRow + 1
.Rows(i).Cut _
Worksheets("Futures").Cells(iNextRow, "A")
End If
Next i
End With


Thanks a lot!

Rgds,
Robert



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
Line copy - Not just a simple copy paste Ninerref Excel Worksheet Functions 3 September 10th 09 11:44 AM
A copy of a chart doesn't change when the original has new range Piotr (Peter)[_2_] Charts and Charting in Excel 10 September 8th 08 06:55 PM
copy formula down and ever change range Dean Excel Programming 3 June 6th 06 05:05 PM
change a range colour after copy to another worksheet Kezza Excel Programming 3 May 11th 06 02:59 PM
Copy a Range from sheet and paste the next blank line in anoth ca1358 Excel Programming 1 December 2nd 05 09:18 AM


All times are GMT +1. The time now is 07:12 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"