+ Reply to Thread
Results 1 to 9 of 9

Macro code to Copy specific rows into specific columns

  1. #1
    Registered User
    Join Date
    09-28-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    65

    Question Macro code to Copy specific rows into specific columns

    Hi

    I am not a programming person...really struggling to write a macro. I am good for recording macros but not in programming. But I would really really appreciate if anyone can help me in solving my problem.

    I am trying to copy Extract-batch 13(sheet1 which is dp here) all the rows until a blank row comes to ShareWB (Sheet1, called DP again) from J column though to M in the sequence but I want this to be pasted exactly after the data column(In this case this is J14 to M14). For coding purpose if macro understand 'blank' column. I can say to paste it in the same sequence J to M where it encounter a blank (For J column in this case). After this I have to apply some formulas...but that I can manage. I just need the code for copy and paste..its not very simple I guess.

    This is a reconcilation tool. So I will be collating the data after each extract in the same sheet. And I have this to do for all the 4 sheets DP,RP,DC and RC.

    PFA the worksheets. (Extract-batch 13 and ShareWB).

    Thanks for looking and helping.
    Su.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    09-28-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    65

    Re: Macro code to Copy specific rows into specific columns

    Below is my code:

    Please Login or Register  to view this content.
    Last edited by arlu1201; 10-11-2012 at 07:25 AM.

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro code to Copy specific rows into specific columns

    macrofan,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature below this post.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro code to Copy specific rows into specific columns

    So if i understand your question correctly, you want all data except headers from extract batch file to be copied to the share WB file. Any conditions or just a copy paste?

  5. #5
    Registered User
    Join Date
    09-28-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    65

    Re: Macro code to Copy specific rows into specific columns

    Hi Arlette,

    Thanks for your reply.

    No other conditions really.

    I just want to copy all the data from extract (Here in the sample file rows 2 to 10) to be copied to where it finds the blank row, here it's 14th row and Column J through to M in the same sequence as it is).

    The extract normally have more 1000 records and multiple sheets.

    Thanks,
    Su.

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro code to Copy specific rows into specific columns

    Will the destination file be open at the time of the copy paste or should it be opened by the macro?

    Will the macro reside in the source file?

  7. #7
    Registered User
    Join Date
    09-28-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    65

    Re: Macro code to Copy specific rows into specific columns

    Destonation file would be opened at that time, yes.

    I need the macro in destination file...so I will run and macro and that should do the purpose.

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro code to Copy specific rows into specific columns

    Try this code. Copy it into a standard module of your destination file -
    Please Login or Register  to view this content.
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose View | Macros
    Select a macro in the list, and click the Run button

  9. #9
    Registered User
    Join Date
    09-28-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    65

    Re: Macro code to Copy specific rows into specific columns

    Thank you very much Arlette...I really appreciate. Thanks again...:-)

    Su.

+ 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