Results 1 to 3 of 3

Buggy Sheet Consolidation Behaviour

Threaded View

  1. #1
    Registered User
    Join Date
    10-07-2008
    Location
    London
    Posts
    39

    Buggy Sheet Consolidation Behaviour

    Hello all,

    For some time now I've been happily using some VBA code provided by the brilliant JBeaucaire to consolidate data from several sheets into one.

    I now need to create a second sheet to do something very similar, but for some reason it only takes data from two of the five sheets, and not even all of that. The VBA to capture and paste the data seems the same in both cases (apart from target cells and subsequent offset data grabs), and I've pasted it at the end of this post.

    I've attached an example of the workbook I'm working on:
    - The sheet that works properly is 'Summary' and the code is in 'ModuleConsolidateSheets'.
    - The sheet that doesn't work properly is 'UPS P&L' and the code is in 'ModulePLConsolidateSheets'
    The code is triggered by selecting the respective workbooks.

    Does anyone have any idea why the latter returns so much less data than the first?!



    'Process each data sheet
        For Each ws In Worksheets
            If ws.Name = "OMS MON" Or ws.Name = "OMS TUE" Or ws.Name = "OMS WED" Or ws.Name = "OMS THUR" Or ws.Name = "OMS FRI" Then
                LR = ws.Range("D" & ws.Rows.Count).End(xlUp).Row
                
            'customize this section to copy what you need
                Set CpyRNG = ws.Range("D6:D" & LR).SpecialCells(xlConstants)
    
    Then CpyRNG.Copy cs.Range("A" & NR) on one and
            CpyRNG.Copy cs.Range("H" & NR) on the other.
    
    Then each has a series of CpyRNG.Offset lines to grab nearby data.
    Attached Files Attached Files
    Last edited by shockeroo; 07-27-2010 at 07:43 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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