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!
Bookmarks