+ Reply to Thread
Results 1 to 4 of 4

Copy several columns and paste into specific column on another worksheet

  1. #1
    Registered User
    Join Date
    10-22-2012
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    2

    Copy several columns and paste into specific column on another worksheet

    Hi,


    Need help on modify the VBA. I need to copy several column from sheet "FXSwap" when meet the criteria and paste value into specific column on sheets "=FEC=". Copy from sheet "FXSwap" column (A,B,AU,C) to "=FEC=" column (E,F,G,H). But my code cannot work, it will become A to E, B to F, C to G and AU to H. How should I change the VBA code to make column AU will copy to G and C will copy to H. Thanks

    Here my VBA code:



    Sub Macro8()

    Sheets("FxSwap").Select

    FinalRow = Range("A65536").End(xlUp).Row

    For x = 2 To FinalRow

    ThisValue = Range("I" & x).Value
    If ThisValue = "20120924" Then
    Range("A" & x & ",B" & x & ",AU" & x & ",C" & x).Copy
    Sheets("=FEC=").Select
    NextRow = Range("C65536").End(xlUp).Row + 1
    Range("C" & NextRow).Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False

    Sheets("FXSwap").Select
    End If
    Next

    End Sub

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy several columns and paste into specific column on another worksheet

    Please attach a sample book with your code and desired result.

  3. #3
    Registered User
    Join Date
    10-22-2012
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Copy several columns and paste into specific column on another worksheet

    Here attached the desired result with my VBA code. Hope you can help me to solve the problem. Thank you very much
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy several columns and paste into specific column on another worksheet

    ICY,
    I do not know for sure which criteria you are trying to compare with, but I guessed it is column "I" of FXSwap of sheet with Column "B" of =FEC=. This is a simple macro which copies data from one sheet to another based on the columns you had indicated on your sample.
    Please Login or Register  to view this content.
    I have also tried to work a code based on my assumption, but keep getting error on this line.
    Please Login or Register  to view this content.
    Perhaps, other memebers could spot my error.

    Please Login or Register  to view this content.

+ Reply to Thread

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