+ Reply to Thread
Results 1 to 10 of 10

Looping help, VBA, copy one row (data in 3 columns) and paste in another sheet to 12rows

  1. #1
    Registered User
    Join Date
    08-28-2022
    Location
    sweden
    MS-Off Ver
    10
    Posts
    6

    Question Looping help, VBA, copy one row (data in 3 columns) and paste in another sheet to 12rows

    HI,

    I am trying to build looping in VBA, as i am new to VBA with basic skills i couldn't find the right technique to do this task, it is really more time consuming to do manually so am looking run this as loop through VBA

    I have list of details in one sheet which to be copied to another sheet for 12 rows each and continues so on until it covers all rows from sheet 1

    Sheet1: column G, column H and column I contains data, this data updates every time when i paste new data in another sheet, so i number of rows are not fixed ( may be xldown code helps)

    procedure: copy row data from sheet 1 which includes data from G2, H2 & I2 and paste in sheet2 A2 to A14 (it should paste for 12 rows) and mean while it also paste B2 to B14 & C2 to C14.
    and next step is go back to sheet 1 copy G3,H3 & I3 and paste in sheet 2 from A15 to A26 (next 12 rows) and this will continue until it covers all data from sheet 1

    could anyone help me to build this code please
    Attached Files Attached Files
    Last edited by holla_hc; 08-28-2022 at 07:33 AM.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Looping help, VBA, copy one row (data in 3 columns) and paste in another sheet to 12ro

    @holla_hc welcome to the excel forum.


    Maybe I can't help you with your problem, but this would be a great start.


    HOW TO ATTACH YOUR SAMPLE WORKBOOK:

    Fast answers need clear examples. Post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information (10-20 rows, not thousands...) and some manually calculated results. For a new thread (1st post), scroll to Manage Attachments, otherwise scroll down to GO ADVANCED, click, and then scroll down to MANAGE ATTACHMENTS and click again. Now follow the instructions at the top of that screen.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    08-28-2022
    Location
    sweden
    MS-Off Ver
    10
    Posts
    6

    Re: Looping help, VBA, copy one row (data in 3 columns) and paste in another sheet to 12ro

    Hi Oeldere

    Thanks for quick reply, i have attached a sample file to demonstrate the issue which i am facing, this is not the final workbook which i a working but i hope it gives picture for what i am looking for
    Last edited by holla_hc; 08-28-2022 at 05:13 AM.

  4. #4
    Registered User
    Join Date
    08-28-2022
    Location
    sweden
    MS-Off Ver
    10
    Posts
    6

    Re: Looping help, VBA, copy one row (data in 3 columns) and paste in another sheet to 12ro

    Hello all,

    Can anyone help me on this please

  5. #5
    Registered User
    Join Date
    08-28-2022
    Location
    sweden
    MS-Off Ver
    10
    Posts
    6

    Re: Looping help, VBA, copy one row (data in 3 columns) and paste in another sheet to 12ro

    i started like this, but it doesn't help

    '........looping user details to user table
    Sub looping()

    Dim lngLastRow As Long
    Dim lngRow As Long
    Sheets("EDB_Pack_Users").Select
    lngLastRow = Cells(Rows.Count, "G").End(xlUp).Row
    For lngRow = 3 To lngLastRow
    Range(Cells(lngRow, "G"), Cells(lngRow, "G")).Copy
    Sheets("EDB_Pack_User Table").Select
    'Cells(Rows.Count, "A").End(xlUp).Offset(1).Resize(12, 3)

  6. #6
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Lightbulb Re: Looping help, VBA, copy one row (data in 3 columns) and paste in another sheet to 12ro

    Hi
    Try

    Please Login or Register  to view this content.
    Last edited by mohadin; 08-28-2022 at 07:00 AM. Reason: MODIFIED

  7. #7
    Registered User
    Join Date
    08-28-2022
    Location
    sweden
    MS-Off Ver
    10
    Posts
    6

    Re: Looping help, VBA, copy one row (data in 3 columns) and paste in another sheet to 12ro

    HI,

    I tried this one, it works but problem is it copy each row and paste as needed but it overwrites the data and at the end it keeps only the last row data in another sheet, probably some minor change in coding needed

  8. #8
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Looping help, VBA, copy one row (data in 3 columns) and paste in another sheet to 12ro

    I did modified it
    Please copy it again

  9. #9
    Registered User
    Join Date
    08-28-2022
    Location
    sweden
    MS-Off Ver
    10
    Posts
    6

    Re: Looping help, VBA, copy one row (data in 3 columns) and paste in another sheet to 12ro

    Thank you its working perfectly

    Thank you so much

  10. #10
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Looping help, VBA, copy one row (data in 3 columns) and paste in another sheet to 12ro

    you are very welcome
    And thank you for the feedback
    Be happy and safe

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy Data from current sheet with Auto Filter/Looping then paste to another sheet
    By stepkwan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-04-2020, 09:04 AM
  2. [SOLVED] Copy Data from Columns, paste on new sheet at end of previous Data
    By snuffnchess in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-30-2019, 11:26 AM
  3. VBA to Copy certain columns of data and paste into a new sheet
    By tiger01 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-06-2013, 05:58 AM
  4. Looping through Worksheets, Copy/Paste Each Sheet during Loop
    By eduardito in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-02-2012, 07:01 AM
  5. Visual basic: looping a copy paste function through columns
    By Frey in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-12-2012, 07:39 AM
  6. Looping through worksheets to copy/paste to new sheet - last sheet never copies
    By lifeboat in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-10-2011, 01:53 PM
  7. Replies: 2
    Last Post: 02-22-2011, 02:07 AM

Tags for this Thread

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