+ Reply to Thread
Results 1 to 4 of 4

VBA To Copy and Paste A Range After Changing 1 Cell

  1. #1
    Registered User
    Join Date
    12-30-2019
    Location
    NYC
    MS-Off Ver
    2018 Microsoft Excel
    Posts
    1

    Question VBA To Copy and Paste A Range After Changing 1 Cell

    Hello, I hope all is well.

    I have an excel spreadsheet where all I need to do is run the following loop:

    (1) Change Cell Sheet1_$G$11 to Sheet2_$Y21 (starts with Y21, then after the loop it should go down one and repeat the process)
    (2) Once this is done, sort a table I have from Sheet1_$A$20:$U$15053 by M (ascending so highest # is at top)
    (3) Then copy range Sheet1_$G$21:$U$21 (since this will be the highest row once ascending) and paste special (values) this range in Sheet2_$Z21
    (4) Start over by changing Cell Sheet1_$G$11 to Sheet2_$Y22 and repeating the process.

    Can anyone please help? Thanks!

    Had a friend send us this over to try but it's unfortunately not working correctly. Any help?

    Please Login or Register  to view this content.
    Last edited by davesexcel; 12-31-2019 at 10:34 AM.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,080

    Re: VBA To Copy and Paste A Range After Changing 1 Cell

    It would be easier to help if you could attach a copy of your file (de-sensitized if necessary). Include a sheet showing the expected results. Also, when you sort by "ascending", the data will be sorted with the lowest number at the top not the highest number. If you want the highest number at the top, you would have to sort by "descending". Please clarify.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    12-19-2019
    Location
    mi, usa
    MS-Off Ver
    2013
    Posts
    12

    Re: VBA To Copy and Paste A Range After Changing 1 Cell

    as a guess at what you are trying to do try this - it should be a good start for you to adjust as needed

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,301

    Re: VBA To Copy and Paste A Range After Changing 1 Cell

    Quote Originally Posted by anil92 View Post
    ... loop ... starts with Y21:
    (1) ... Sheet1_$G$11 = Sheet2_$Y21
    (2) ... sort a table ... Sheet1_$A$20:$U$15053 by M (ascending ...)
    (3) ... copy range Sheet1_$G$21:$U$21 ... and paste ... values ... in Sheet2_$Z21
    (4) ...repeating the process
    If row_amount (on "Sheet2") will be equal 15053 (as on Sheet1 = "A20:U15053") or something like that, then with such a number of repetitions of sheet sorting, you will "murder" excel ... excel rip ... amen ... then you will have to perform all operations in the windows notepad ...

    Post some reliable sample file with false data.

+ 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. how to copy paste the formula downwards by changing the range
    By sumesh56 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-24-2017, 12:31 PM
  2. Copy/paste range of cells without changing refrences
    By InvalidTxtString in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-05-2016, 07:07 AM
  3. Copy/Paste Range Several Times while changing a few cells in 1-2 rows
    By smiket in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-04-2015, 04:00 PM
  4. Changing the copy and paste Range
    By gjaylward2008 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-13-2012, 09:58 AM
  5. Copy / Paste w/o Cell Reference Changing
    By jonathanw in forum Excel General
    Replies: 1
    Last Post: 04-27-2010, 10:38 AM
  6. Replies: 3
    Last Post: 10-20-2006, 03:33 PM
  7. Copy and Paste macro needs to paste to a changing cell reference
    By loulou in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-24-2005, 07:06 AM

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