Results 1 to 6 of 6

copy data from two or more worksheets specified

Threaded View

  1. #1
    Forum Contributor iscar_marius's Avatar
    Join Date
    12-19-2008
    Location
    germany
    MS-Off Ver
    2000 and 2003
    Posts
    221

    copy data from two or more worksheets specified

    I need to copy data from two ore more worksheets with specified name in a column.

    Input data:
    -name of the worksheets to be copied in column "H" from sheet "final"
    -diferent number in the worksheets in column "F" and "G"

    Outpt data:
    -I need to copy data from some worksheets(column F and G) in "final" worksheet (column A and B). But I need to copy data only from the worksheets with the name in column "H" of "final" worsksheet.

    Until now I have this code:
    Sub x()
    
    
    Range(Cells(2, "A"), Cells(Rows.Count, "A").End(xlUp)).ClearContents
    Range(Cells(2, "B"), Cells(Rows.Count, "B").End(xlUp)).ClearContents
    
    
    Dim ws As Worksheet
    
    For Each ws In Worksheets
        Select Case ws.Name
            Case "s1", "d4"
                With ws
                    .Range("F3", .Range("G" & Rows.Count).End(xlUp)).Copy Sheets("final").Cells(Rows.Count, 1).End(xlUp)(2)
                End With
        End Select
    Next ws
    
    End Sub
    It works, but I have to type in the code of the worksheets names to be copied.
    I would like to type the name of the worksheets to be copied in worksheet "final" in column H.
    Please open attached file!
    Thanks!
    Last edited by iscar_marius; 02-12-2009 at 04:37 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