+ Reply to Thread
Results 1 to 8 of 8

merging two sheet by VBA: missing rows

  1. #1
    Forum Contributor
    Join Date
    04-21-2012
    Location
    rome, italy
    MS-Off Ver
    365
    Posts
    133

    merging two sheet by VBA: missing rows

    i tried to merge 2 sheets by VBA but i have some problems in result.
    see attached sheet.

    there are 5 sheets:
    sheets "area100 datas" and "area200 datas" are raw datas.
    sheets "area100" and "area200" extract raw datas, filter and reorder them.
    so ignore those 4 sheets, are the starting sheets.

    then there is a VBA in the sheet "area100+200" (see the button) that should merge "area100" and "area200" sheets.
    (note: the copy/paste looks for the real number of rows to be copied because row number can change).

    here is the problem:
    some row of sheet "area200" is not copied (in the attached file are missing 2 rows).

    any idea?
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    04-21-2012
    Location
    rome, italy
    MS-Off Ver
    365
    Posts
    133

    Re: merging two sheet by VBA: missing rows

    i see that ion the area100+200 sheet there are formulas (???) while the copy/paste should copy values. is this the problem? how to solve it?

  3. #3
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,505

    Re: merging two sheet by VBA: missing rows

    If it's only about 2 sheets, then this is the fasted way (using arrays to write directly to sheet 1, instead of copy/paste)

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    04-21-2012
    Location
    rome, italy
    MS-Off Ver
    365
    Posts
    133

    Re: merging two sheet by VBA: missing rows

    solved. was missing the "Paste:=xlPasteValues" at the end of paste code.

    tomorrow i will try your solution it's shorter

  5. #5
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,505

    Re: merging two sheet by VBA: missing rows

    Note that every select/activate in VBA is unnecessary. They make your code very slow.

  6. #6
    Forum Contributor
    Join Date
    04-21-2012
    Location
    rome, italy
    MS-Off Ver
    365
    Posts
    133

    Re: merging two sheet by VBA: missing rows

    Ok. How can I change my code without select/activate? How canvba know the sheet is working on?

  7. #7
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,505

    Re: merging two sheet by VBA: missing rows

    For example, this is how you paste a1 from sheet 1 to sheet 2. Look at how I refer to specific sheets:

    Sheets(1).[A1].copy sheets(2).[A1]

  8. #8
    Forum Contributor
    Join Date
    04-21-2012
    Location
    rome, italy
    MS-Off Ver
    365
    Posts
    133

    Re: merging two sheet by VBA: missing rows

    thank you. problem solved.

+ 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. pulling missing rows from different sheet
    By tenerifa6 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-15-2021, 03:00 PM
  2. [SOLVED] Group sheets into 1 single sheet missing rows
    By missbb in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-22-2020, 09:30 AM
  3. Merging and Summing Duplicate Rows To Table in Another Sheet
    By votekinky06 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2018, 10:14 PM
  4. A sheet for tracking missing rows
    By Windbrand in forum Excel General
    Replies: 3
    Last Post: 02-18-2018, 10:15 AM
  5. [SOLVED] Adding rows while merging sheets into a master sheet
    By sbidgol in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-11-2014, 10:00 AM
  6. copy rows to another sheet after merging using specific creteria
    By saurabh2k26 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-16-2013, 10:37 AM
  7. Merging data in rows and exporting to a new sheet
    By endoskeleton in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-19-2011, 10:53 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