![]() |
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 |
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 |
All times are GMT +1. The time now is 07:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com