Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / February 2007

Tip: Looking for answers? Try searching our database.

VBA, change 'copy line' into 'copy range'

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robert - 14 Feb 2007 09:05 GMT
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
Bob Phillips - 14 Feb 2007 09:17 GMT
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

Signature

HTH

Bob Phillips

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

> Hi all,
>
[quoted text clipped - 18 lines]
> Rgds,
> Robert
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.