+ Reply to Thread
Results 1 to 10 of 10

Loop copy cell of range to 1 cell, and so on till cell empty

  1. #1
    Forum Contributor
    Join Date
    06-24-2004
    MS-Off Ver
    Excel 2013 Pro Plus
    Posts
    122

    Loop copy cell of range to 1 cell, and so on till cell empty

    Hello friends, Hope all is well!

    Please help me: I am trying to have a loop, that will:

    a. Go through sheet “COLUMN”
    b. Through ranges “R2” till there is no more data (empty cells in the R range)
    c. And copy the contents of R current active cell and pastes it in X2, and so on.
    This way X2 keeps changing till the loop end.
    d. If the looped range / active cell equals NO, code go on to the next cell and so on

    Thank you so much in advance!
    Attached Files Attached Files

  2. #2
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Loop copy cell of range to 1 cell, and so on till cell empty

    Maybe :
    Please Login or Register  to view this content.
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  3. #3
    Forum Contributor
    Join Date
    06-24-2004
    MS-Off Ver
    Excel 2013 Pro Plus
    Posts
    122

    Re: Loop copy cell of range to 1 cell, and so on till cell empty

    Thanks a lot! But I am having difficulties with your code.
    it keeps repeating the same results.

    I if you don't mind tried on my own and came up with this matter:

    I am stuck below, because ActiveCell.Offset(1, 0).Select

    is at X2, not at the R ranges. if that can be fixed I think all will be sorted.


    Please Login or Register  to view this content.
    Last edited by countryfan_nt; 02-13-2017 at 01:02 PM.

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Loop copy cell of range to 1 cell, and so on till cell empty

    Hello countryfan_nt,

    Please try:

    Please Login or Register  to view this content.
    No loop.

    Kind Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  5. #5
    Forum Contributor
    Join Date
    06-24-2004
    MS-Off Ver
    Excel 2013 Pro Plus
    Posts
    122

    Re: Loop copy cell of range to 1 cell, and so on till cell empty

    I am so sorry and grateful, but I doubt this will solve the code issue that I am having. You see the loop makes changes to filter of a pivot table, and then is responsible for the TOs in the email sending.
    that is why I need a loop. Please look at the last post that I made, there you will see the challenge that I am currently struggling with.

  6. #6
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Loop copy cell of range to 1 cell, and so on till cell empty

    You are welcome.

    The problem is by executing this line :
    Please Login or Register  to view this content.
    the activecell now become this cell (X2), so that :
    Please Login or Register  to view this content.
    will always select cell X3.

    You need to use a variable as holder to keep track current pointer on column R, like this :

    Please Login or Register  to view this content.

  7. #7
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Loop copy cell of range to 1 cell, and so on till cell empty

    Hi countryfan_nt,

    Thank you for your reply. howerever, your sample Workbook does not display a Pivot Table, hence the confusion.

    Please could you update your attachment sample?

    Thank you.

  8. #8
    Forum Contributor
    Join Date
    06-24-2004
    MS-Off Ver
    Excel 2013 Pro Plus
    Posts
    122

    Re: Loop copy cell of range to 1 cell, and so on till cell empty

    Karedog and Winon! thank you both it worked!

  9. #9
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Loop copy cell of range to 1 cell, and so on till cell empty

    You are welcome, thanks for marking the thread as solved and rep.points.

    Regards

  10. #10
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Loop copy cell of range to 1 cell, and so on till cell empty

    Hi countryfan_nt,

    You are welcome, glad we could help, and thanks for the Rep.

    Kind Regards.

+ 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. Replies: 2
    Last Post: 07-21-2016, 09:40 PM
  2. [SOLVED] Help needed with loop and copy if cell not empty
    By wishmaker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-08-2014, 01:01 PM
  3. [SOLVED] Copy range downwards till certain cell
    By Jonathan78 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-25-2013, 12:44 PM
  4. [SOLVED] How to copy into next empty row using "for each cell in range" loop
    By GIS2013 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-23-2013, 02:30 PM
  5. [SOLVED] Search backward in range till empty cell
    By fedude in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-06-2013, 08:00 AM
  6. [SOLVED] Find empty cell till next value merge or copy the respective cells in next column
    By rpriyadharsini1987 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2013, 03:46 AM
  7. How to fill down particular cell contains till last empty cell
    By nur2544 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-28-2013, 02:16 PM

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