+ Reply to Thread
Results 1 to 3 of 3

Loop and Paste each time in Next Cell

  1. #1
    Registered User
    Join Date
    12-17-2012
    Location
    Athens
    MS-Off Ver
    Excel 2016
    Posts
    65

    Loop and Paste each time in Next Cell

    Hi to all and thank in advance for your help.

    I need your help in something. I want to create a loop which will do the following

    Select "Virgin new num" sheet
    Select Range A7:A1507 from "Virgin new num" sheet
    Copy Range from A7:A1507,
    Select "Data" Sheet
    Paste Special to A7
    Select "Virgin new num" sheet
    Select K1 cell
    Delete (each time that I delete the K1 cell in generates a new set of random numbers in A7:A1507).

    This loop must do the same except the fact that I need each time it loops, it should paste the A7:1507 dataset of in the adjacent cell of "Data" Sheet. So the first time it must paste it in A7, the second in B7, the third in C7 etc.

    I Have created the steps in the following macro, but I don't know how to loop it


    Sheets("Virgin new num").Select
    Range("A7:A1507").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    Sheets("Data").Select
    Range("A7").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Sheets("Virgin new num").Select
    Range("K1").Select
    Application.CutCopyMode = False
    Selection.ClearContents
    End Sub

    P.S. I must also have a way to end the loop whenever I want
    Last edited by komhs; 11-18-2022 at 07:27 AM.

  2. #2
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    365 32bit Win
    Posts
    1,922

    Re: Loop and Paste each time in Next Cell

    This will keep running until you switch away from the Data sheet or it runs out of columns.
    Not sure why you need to delete K1


    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-17-2012
    Location
    Athens
    MS-Off Ver
    Excel 2016
    Posts
    65

    Re: Loop and Paste each time in Next Cell

    First of all thank you for your reply.

    I delete K1 just to make a move in order to generate new random data set in Rows A7:A1507. I am using the RANDBETWEEN function. so every time that I am doing something (like delete an empty cell) it generates new data set.

+ 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. [SOLVED] Copy Cell From One Cell and Paste to next blank cell, Loop until last row/column
    By Beginner Level in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-01-2020, 02:38 AM
  2. [SOLVED] VBA to loop through cell-defined range and paste table output after each loop.
    By mscott123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-18-2019, 03:41 AM
  3. Open file path from cell, paste into new sheet named from another cell and loop
    By LAUGHINGCROW in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-11-2019, 12:09 PM
  4. Copy Paste Loop slows down over time
    By ugabrew in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-15-2016, 02:51 PM
  5. [SOLVED] Copy and Paste cell value in for loop
    By chouston in forum Excel Programming / VBA / Macros
    Replies: 32
    Last Post: 03-16-2013, 09:23 AM
  6. [SOLVED] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 PM
  7. Copy and paste named range at end of loop causing massive slowdown over time
    By Sccye in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-12-2013, 07:03 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