Results 1 to 4 of 4

copy and paste a range of cells to the left

Threaded View

  1. #1
    Registered User
    Join Date
    06-03-2010
    Location
    Sydney
    MS-Off Ver
    Excel 2003
    Posts
    3

    copy and paste a range of cells to the left

    Hi all, I am new to writing up code in VBA. i am trying to copy cells on a range and paste them to the left into colums A to D. the maro runs but it get rid every second existing raw. This is what I am doing (see the picture), and the code is:

    Sub CopyPaste()

    Dim I As Long, LastLine As Long
    Dim R As Integer

    Sheets(2).Activate
    LastLine = Cells(Rows.Count, "A").End(xlUp).Row

    R = 0
    For I = R + 2 To LastLine
    Sheets(2).Range("G" & I & ":J" & I).Copy
    Range("A" & I & ":D" & I).PasteSpecial
    R = R + 2
    Next

    MsgBox "Done"
    End Sub

    I would appreciate if someone can can point me in the right direction, thanks heaos!
    Attached Images Attached Images
    Last edited by michaelram; 06-03-2010 at 09:19 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1