+ Reply to Thread
Results 1 to 4 of 4

For loop that pastes data using calculated row # and advances +1 column each time.

  1. #1
    Registered User
    Join Date
    07-21-2008
    Location
    Georgia
    MS-Off Ver
    2007
    Posts
    18

    For loop that pastes data using calculated row # and advances +1 column each time.

    Hello. I need a simple VBA code that will copy a range of data Sheet3.C4:C42 and paste, it into specific row numbers and columns. The row numbers are calculated and are in range Sheet1.H24:H64.

    Step by step, I would like the macro to:

    1. Copy "Data" Sheet3.C4:C42
    2. Look at the Row# in cell Sheet1.H24
    3. Paste "Data" into column "C", row "(H24)" (Sheet 2)
    4. Repeat "X" # of times. X is a number I will type into a cell (Say "E22") so if I want the loop to repeat 10 times, I will type "10" in Sheet1.E22.
    5. For each time it repeats, it should advance +1 column (so next it will paste the data to column "D")
    6. For each time it repeats, it should also use the next value in the range H24:H64 to get the correct row #. (so next it will use the number in H25 as it's row #)

    This seems simple, but I am really having a hard time digging through the forums and search engines to find a good enough explanation of loops and the rules associated.

    Any help is appreciated! Thank you! I attached a file to help.
    Attached Files Attached Files
    Last edited by rylo; 04-03-2011 at 05:43 PM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: For loop that pastes data using calculated row # and advances +1 column each time

    Hi

    Here goes.
    Please Login or Register  to view this content.
    rylo

  3. #3
    Registered User
    Join Date
    07-21-2008
    Location
    Georgia
    MS-Off Ver
    2007
    Posts
    18

    Re: For loop that pastes data using calculated row # and advances +1 column each time

    Worked like a charm! I almost had a code that would run it, but it wasn't looping to change the row #'s. Your code is much more condensed and does the same thing. Much appreciated!!

  4. #4
    Registered User
    Join Date
    07-21-2008
    Location
    Georgia
    MS-Off Ver
    2007
    Posts
    18

    Re: For loop that pastes data using calculated row # and advances +1 column each time

    rylo, it's funny that you got me the answer for this. You helped me solve a problem using VBA almost 2 years ago. I was looking through old posts and saw where you had come to the rescue and provided me with the answers I was looking for.

    Just wanted to say thanks again. I hope you continue to stick around because I know I'll probably need your help again in the future!

    -Ryan

+ 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