+ Reply to Thread
Results 1 to 11 of 11

Help with Copy and Paste VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    07-10-2020
    Location
    Rhondda, Wales
    MS-Off Ver
    Excel
    Posts
    5

    Help with Copy and Paste VBA

    Hey guys,

    I need to copy and paste values from the last row of data. I have a table with week numbers in column A with a selection of data (Formulas) going across the row. I want to copy and paste this data at the end of each week, so this week copy and paste values Week 28 and next week copy and paste values in Week 29.

    Can someone please help!

    Thanks
    Attached Images Attached Images

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,873

    Re: Help with Copy and Paste VBA

    Try:
    sub test()
    Range(cells(rows.count,"C").end(xlup),cells(rows.count,"F").end(xlup)).copy cells(rows.count,"C").end(xlup).offset(1,0)
    end sub
    Best Regards,

    Kaper

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,824

    Re: Help with Copy and Paste VBA

    Welcome to the forum.

    Please update your user profile with the VERSION of Excel that you are using.

    You have not said where these rows should be copied from and to.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  4. #4
    Registered User
    Join Date
    07-10-2020
    Location
    Rhondda, Wales
    MS-Off Ver
    Excel
    Posts
    5

    Re: Help with Copy and Paste VBA

    I want to copy and paste the values into the same group of cells to eliminate the formula in the cells...

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,873

    Re: Help with Copy and Paste VBA

    rows(28).value=rows(28).value
    would do it (replacing formulas with values) in row 28.

  6. #6
    Registered User
    Join Date
    07-10-2020
    Location
    Rhondda, Wales
    MS-Off Ver
    Excel
    Posts
    5

    Re: Help with Copy and Paste VBA

    Thank you, but each time I run the I need it to do the row below. Each week I need to run this macro and copy and paste the values for that week. So it will be the last row with data in each time. Does this make sense?

  7. #7
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,873

    Re: Help with Copy and Paste VBA

    Perhaps:
    Dim lastrow As Long
    lastrow = Columns("C:C").Find(what:="", after:=Range("C1"), searchdirection:=xlNext, _
      LookIn:=xlValues, lookat:=xlWhole).Row-1
    Rows(lastrow).Value = Rows(lastrow).Value
    Please note you still have not published the attachment, so we don't know what is for instance in cell C30 etc.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,824

    Re: Help with Copy and Paste VBA

    @James1504

    Please review and respond to post #3.

  9. #9
    Registered User
    Join Date
    07-10-2020
    Location
    Rhondda, Wales
    MS-Off Ver
    Excel
    Posts
    5

    Re: Help with Copy and Paste VBA

    Done now thank you

  10. #10
    Registered User
    Join Date
    07-10-2020
    Location
    Rhondda, Wales
    MS-Off Ver
    Excel
    Posts
    5

    Re: Help with Copy and Paste VBA

    How do mark as solved?

  11. #11
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,873

    Re: Help with Copy and Paste VBA

    Near the top of the page (just above your first original post) you will find "Thread Tools" drop down, and there is a link to mark thread SOLVED
    Attached Images Attached Images

+ 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: 3
    Last Post: 01-01-2015, 06:26 AM
  2. [SOLVED] Copy Paste Loop ends before copy/paste is finished
    By brgr4u in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-08-2013, 04:01 PM
  3. Automate copy and paste and copy and paste back to excel
    By Bmw318be in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2013, 05:42 AM
  4. Automate copy and paste and copy and paste back to excel
    By Bmw318be in forum Access Tables & Databases
    Replies: 0
    Last Post: 02-23-2013, 05:42 AM
  5. Replies: 1
    Last Post: 01-16-2013, 05:36 AM
  6. 2 Macro's: only vertical copy/paste action and copy-paste 14 columns to the right.
    By vdongen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2010, 10:34 AM
  7. Replies: 1
    Last Post: 01-04-2005, 06:06 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