+ Reply to Thread
Results 1 to 4 of 4

Copying and pasting to another sheet with loops

  1. #1
    Registered User
    Join Date
    06-19-2015
    Location
    Michigan
    MS-Off Ver
    2010
    Posts
    30

    Copying and pasting to another sheet with loops

    I need to write a macro that loops through all my sheets and copies and pastes cells in a column that contain #VALUE! into another sheet, and all the copies from one sheet are in one row on the paste sheet.

    Basically I need it to read like this:

    Loop through each sheet in the workbook
    If the sheet tab is yellow then
    Copy cell A5 and paste in the first empty column in the last sheet
    Loop through K7:K40 in the original sheet
    if any cell in K7:K40 is #VALUE! then
    copy offset(0, -10) and paste in the cell next to where A5 was pasted
    Go to the next sheet and copy and paste everything in the next row down.

    So my final sheet will look like this:
    A B C D
    1 (Pasted A5 Data from Sheet1) (Pasted K cell Data from Sheet1) (Pasted K cell Data from Sheet1) (Pasted K cell Data from Sheet1)
    2 (Pasted A5 Data from Sheet2) (Pasted K cell Data from Sheet2) (Pasted K cell Data from Sheet2) (Pasted K cell Data from Sheet2)
    3 (Pasted A5 Data from Sheet3) (Pasted K cell Data from Sheet3) (Pasted K cell Data from Sheet3) (Pasted K cell Data from Sheet3)

    I am having a hard time trying to explain exactly what I want, but if anyone understands this I would greatly appreciate your help.

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Copying and pasting to another sheet with loops

    You example says "K Cell", but your description says A cell (Offset(0,-10) in the K row with "#VALUE!". Not sure which you want, I went with the latter.

    Change the .Color value if needed to match whatever shade of yellow you're wanting.

    Please Login or Register  to view this content.
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Registered User
    Join Date
    06-19-2015
    Location
    Michigan
    MS-Off Ver
    2010
    Posts
    30

    Re: Copying and pasting to another sheet with loops

    Holy moley you are a life saver! Thank you so much!

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Copying and pasting to another sheet with loops

    Glad to help. If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Copying and pasting to another sheet
    By MeggieDoodles in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2016, 01:49 PM
  2. Replies: 8
    Last Post: 02-01-2016, 09:30 AM
  3. Copying & pasting a current region to another sheet w/o actually copying.....
    By Excel_vba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2014, 09:08 PM
  4. Replies: 9
    Last Post: 05-13-2013, 05:43 AM
  5. Dynamic copying and pasting of rows from one sheet into another sheet
    By princesspeach in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-27-2013, 01:50 PM
  6. Copying All the visible Rows in the current sheet and pasting it to another sheet
    By vickyyar in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-18-2012, 08:46 AM
  7. VBA Copying and Pasting from One Sheet to Another
    By Monkeyboyz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-29-2010, 09:53 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