Excel VBA: automatizando intervalos de cópia de diferentes pastas de trabalho em uma folha de destino final?

Vou gerar alguns gráficos a partir de muitos dados localizados em várias pastas de trabalho. Os dados são formatados exatamente da mesma forma em todas as pastas de trabalho e residem em pastas, todas no mesmo nível. Vou trazer partes (intervalos) dos dados para uma pasta de trabalho final, de onde gerarei meus gráficos.

Isso me fez pensar que esse tipo de coisa está pronto para a automação do VBA. Único problema, eu sou um novato. Eu tentei escrever pseudo-código e substituí-lo pelo que eu acho que é o VBA correto. Procurei exemplos e tentei os arquivos de ajuda do Excel, mas estou perdendo algumas etapas importantes em algum lugar ... e algumas etapas básicas também.

Muitas coisas parecem estar erradas (... pelo menos você terá algo para sorrir antes do fim de semana). Se alguém puder apontar onde meu cérebro me abandonou, ficaria muito grato.

Além disso,como você adiciona o nome do arquivo de origem dos intervalos na coluna B nas mesmas linhas? Isso é algo que realmente me ajudaria, mas não consigo encontrar um exemplo de como fazê-lo.

Sub CopySourceValuesToDestination()

Dim DestPath As String
Dim SourcePath As String
Dim Folder As Variant
Dim Folders As Variant
Dim FileInFolder As Variant
Dim Range1 As Range
Dim Range2 As Range
Dim DesitnationPaste1 As Variant
Dim DesitnationPaste2 As Variant


Folder = Array("ABC", "DEF", "GHI", "JKL")
FileInFolder = Array("ABCFile", "DEFFile", "GHIFile", "JKLFile")

''My final Excel file sits in the parent folder of the source files folders
DestPath = "S:\Common\XYZ\Michael S\Macrotest\"

''Each file has it's own folder, and there are many specific files in each
SourcePath = "S:\Common\XYZ\Michael S\Macrotest\ + Folder"

''Always the same in each of my source files
Range1 = Cells("C4:C8") 
Range2 = Cells("C17:D21") 

''Below I 'm trying to paste Range1 into Column C directly under the last used cell
DestinationPaste1 = Range("C5000").End(xlUp).Offset(1, 0)

 ''Below I 'm trying to paste Range2 into Column D directly under the last used cell
DestinationPaste2 = Range("D5000").End(xlUp).Offset(1, 0)

''Trying to make it loop through the folder and the_
''files...but this is just a guess
For Each Folder In Folders 
''Again a guess
F = 0 

''The rest of the process would open a source file copy_
''Range1 and then opening the Destination file and pasting_
''it in the Row 1 of Column C. Hopefully it then goes back_
''to the open source file copies Range2 and pastes it the_
''next Row down in Column C

    Workbooks.Open FileName:=SourcePath + FileName + "Source.xls"

        Workbook.Sheet(Sheet2).Range1.Copy

    Workbook.Open FileName:=DestPath + "Destination.xls"

        Workbook.Sheet(Sheet1).DestinationPaste.Select
            Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, _
            Operation:= xlNone, SkipBlanks:=False, Transpose:=True

    Windows(SourcePath + FileName + "Source.xls").Activate

        Workbook.Sheet(Sheet2).Range2.Copy

    Workbook.Open FileName:=DestPath + "Destination.xls"

        Workbook.Sheet(Sheet1).DestinationPaste.Select
            Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
            xlNone, SkipBlanks:=False, Transpose:=True

  Windows(SourcePath + FileName + "Source.xls").Activate
    ActiveWorkbook.Close
F = F + 1
Next

End Sub

O resultado do processo seria semelhante à imagem abaixo - mas sem as cores ou a adição "_b":

Saída final de dados http://i51.tinypic.com/14sm6ac.jpg

Muito obrigado novamente por qualquer ajuda que você possa me dar.

Michael.

questionAnswers(1)

yourAnswerToTheQuestion