+ Reply to Thread
Results 1 to 5 of 5

Macro will not paste data into sheet

  1. #1
    Forum Contributor
    Join Date
    01-27-2016
    Location
    Greenville,NC
    MS-Off Ver
    Excel 2013
    Posts
    124

    Macro will not paste data into sheet

    Hello All,

    I've clumsily tried to write a macro that will paste the information that is in column B of the sheet Adama 2018 to column A of the All Data Sorted Sheet. My end game is to somehow write the code to pull all the information from the
    Last edited by rcdavis28; 01-31-2018 at 01:30 PM. Reason: contained sensitive info. could not figure out how to delete posting.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Macro will not paste data into sheet

    The source sheets need to have a standard header layout to write a really efficient code. Otherwise you will likely have to write a separate routine for each source sheet to copy the data over. One way to do it would be to search for the source columns and use the return values to make an array for the columns to copy. You would also need a list or and array of the sheet names you want to copy from. It is clumsy, but it would work. The code below gives and example, but only uses three source sheets. You would need to expand the array to include all the sheets you want to copy from.
    Please Login or Register  to view this content.
    The code uses two arrays. One for the header titles and one for the worksheet objects. It also uses nested For loops with the outer loop controlling the workbook array and the inner loop controlling the header array. The inner loop will search for each header of the 'ALL DATA SORTED' sheet and if found will copy from row 2 and down of the source sheet to the next available row on the 'ALL DATA SORTER' sheet.
    Last edited by JLGWhiz; 01-31-2018 at 01:01 PM.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

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

    Re: Macro will not paste data into sheet

    rcdavis28, you use inconsistent filling in sheets. It is difficult to enumerate rows.
    Example in worksheet 'DOW 18', column 'G'.
    Methods "UsedRange", "CurrentRegion" and others may fail when calculating the number of rows.
    Between the last row of an array/the table with data and the calculations below an array/the table should be a minimum 1 row of gap.
    Columns on the contrary, here you have unnecessary breaks.
    At least arrange the rows.
    Last edited by mjr veverka; 01-31-2018 at 01:12 PM.

  4. #4
    Forum Contributor
    Join Date
    01-27-2016
    Location
    Greenville,NC
    MS-Off Ver
    Excel 2013
    Posts
    124

    Re: Macro will not paste data into sheet

    Thank you all!

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

    Re: Macro will not paste data into sheet

    Very similar macro, but here it search (in other sheets) what you type as the headlines in 'ALL DATA SORTED' sheet, and it copies only values.
    If you organize rows in sheets correctly, the macro should be collecting data.
    Please Login or Register  to view this content.
    Last edited by mjr veverka; 01-31-2018 at 02:51 PM.

+ 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. [SOLVED] Macro To copy data and paste in another sheet
    By mmartinezq202 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-12-2017, 03:28 PM
  2. Replies: 6
    Last Post: 11-25-2015, 02:08 AM
  3. How to write macro to find certain data in master sheet and paste into another sheet?
    By travis.cook21 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2015, 09:21 AM
  4. [SOLVED] Macro to copy data from one sheet, paste in another sheet
    By papi-O in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2014, 04:06 AM
  5. [SOLVED] I'm a new user: Need a macro that will auto paste data from one sheet row to another sheet
    By Daotor in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-22-2013, 10:15 AM
  6. Macro to Copy data from one sheet and paste to another sheet based on a condition
    By SaurabhShri1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-20-2013, 09:30 AM
  7. Macro to search the sheet name and copy and paste the data from a major sheet
    By salma2009 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-04-2009, 02:11 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