+ Reply to Thread
Results 1 to 2 of 2

Copy Data to Master List from Multiple Sheets

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-03-2012
    Location
    CDN
    MS-Off Ver
    Excel 2007
    Posts
    135

    Copy Data to Master List from Multiple Sheets

    HI All,

    I really appreciate the help on this forum!

    I am a huge noob and have modified some vba code to copy data (varying rows all the time) from multiple sheets to a master sheet. I intend to run the code on "Activate".

    Unfortunately, I am getting error even before I get to the copy code, the error is on defining the array of sheets which contain the data to be copied.

    Private Sub Worksheet_Activate()
    
    Dim ws As Worksheet, LR As Long, LT As Long, Lrow As Long, CopyRange As Range
    
    Application.ScreenUpdating = False
    'Sheet2.Unprotect Password:="password"
    Me.UsedRange.Offset(8).Clear                'clears existing report
    
    For Each ws In Sheets(Array("1 - Site", "2 - Building Exterior", "3 - Building Interior", _
                                "4 - Structural", "5 - Mechanical", "6 - Electrical"))
        LR = ws.Range("B" & Rows.Count).End(xlUp).Row
        ws.Range("A3:C" & LR).Copy
        Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValuesAndNumberFormats
        ws.Range("I3:J" & LR).Copy
        Range("E" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValuesAndNumberFormats
        ws.Range("K3" & LR).Copy
        Range("D" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValuesAndNumberFormats
        ws.Range("L3" & LR).Copy
        Range("G" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValuesAndNumberFormats
    Does anyone see whats going on here? "For each sheet" is highlighted on debug.

    For clarification, I am trying to get the array sheets to copy column data to the master for the following columns:
    A2->A9
    B2->B9
    C2->C9
    I3->E9
    J3->F9
    K2->D9
    L2->G9

    Anyone can lend a hand?
    Last edited by Jrub; 10-18-2012 at 01:00 PM.

  2. #2
    Forum Contributor
    Join Date
    10-03-2012
    Location
    CDN
    MS-Off Ver
    Excel 2007
    Posts
    135

    Re: Copy Data to Master List from Multiple Sheets

    Solved, I had a typo in my sheet titles.

    Arghhhh!

+ Reply to Thread

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