Results 1 to 6 of 6

Copy data from multiple sheets

Threaded View

  1. #1
    Registered User
    Join Date
    09-26-2008
    Location
    North Myrtle Beach
    MS-Off Ver
    365 Business
    Posts
    82

    Copy data from multiple sheets

    I am using the following code to copy data from multiple tabs to a summary tab - it is only supposed to copy the data in the rows if the cells in Column A have data in them, its working, but for some reason it is copying the data in columns Y and Z for four extra rows even though there is no data in column A for those rows.....driving me crazy! I am attaching a sample of the workbook here as well - hoping someone can figure out what I have coded wrong I am working in Office 2007.

    Sub SumData()
    '
    ' SummarizeData from Timesheets
    '
        Sheets("Jorge Montoya").Select
        Range("A9").Select
        Set r = Range("A9:A27")
        For n = 1 To r.Rows.Count
        myval = ActiveCell.Value
        
        If InStr(myval, "") > 0 Then
            ActiveCell.Range("A1:Z1").Select
            Selection.Copy
        Sheets("Total by Job_Code").Select
        NextRow = Range("A65536").End(xlUp).Row + 1
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=True, Transpose:=False
        ActiveCell.Offset(1, 0).Select
        End If
        Sheets("Jorge Montoya").Select
        
        ActiveCell.Offset(1, 0).Select
        Next n
        
        Range("A9").Select
        
          
        Sheets("Felipe Estrada").Select
        Range("A9").Select
        Set r = Range("A9:A27")
        For n = 1 To r.Rows.Count
        myval = ActiveCell.Value
        
        If InStr(myval, "") > 0 Then
            ActiveCell.Range("A1:Z1").Select
            Selection.Copy
        Sheets("Total by Job_Code").Select
        NextRow = Range("A65536").End(xlUp).Row + 1
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=True, Transpose:=False
        ActiveCell.Offset(1, 0).Select
        End If
        Sheets("Felipe Estrada").Select
        
        ActiveCell.Offset(1, 0).Select
        Next n
        
        Range("A9").Select
        
        
        Sheets("Kimberly Garcia").Select
        Range("A9").Select
        Set r = Range("A9:A27")
        For n = 1 To r.Rows.Count
        myval = ActiveCell.Value
        
        If InStr(myval, "") > 0 Then
            ActiveCell.Range("A1:Z1").Select
            Selection.Copy
        Sheets("Total by Job_Code").Select
        NextRow = Range("A65536").End(xlUp).Row + 1
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=True, Transpose:=False
        ActiveCell.Offset(1, 0).Select
        End If
        Sheets("Kimberly Garcia").Select
        
        ActiveCell.Offset(1, 0).Select
        Next n
        
        Range("A9").Select
        
    End Sub
    There will end up being about 30 different tabs that it will need to copy from, but the attachment I am including only has 3.

    Thank you in advance for any help!
    Last edited by bjohnsonac; 08-27-2009 at 07:33 AM.

Thread Information

Users Browsing this Thread

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

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