A rotina anexa, faz o que descreveu, porem deve ser adaptada a sua real necessidade
Sub AbreArquivo()
Dim OldName As String, NewName As String, cSheet As String
Dim sDir As String, sPath As String, Msg As String
Dim rw As Long, i As Long
'Guarda o nome do Arquivo ativo
OldName = ThisWorkbook.Name
'Acha o numero da ultima coluna com valores (da linha 1)
rw = Cells(1, Cells.Columns.Count).End(xlToLeft).Column
'Guarda o nome da planilha ativa
cSheet = ActiveSheet.Name
'Determina o caminho a ser utilizado (neste caso mesmo diretorio deste arquivo
sPath = ThisWorkbook.Path
'Acrescenta, se necessario a barra na string do caminho
If Right(sPath, 1) <> "" Then
sPath = sPath & ""
Else
sPath = sPath
End If
'Altera, temporariamente, o diretorio de trabaho, para o determinado na string.
ChDir sPath
sDir = Dir("*.xls?")
'Executa enquanto houver arquivo xls no diretorio
Do While sDir <> ""
If sDir <> OldName Or sdr <> "" Then
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Workbooks.Open Filename:=sDir, UpdateLinks:=3
rw = rw + 1
Workbooks(OldName).Sheets("BD").Cells(1, rw) = Workbooks(sDir).Sheets("Síntese").Cells(33, 3).Value
Workbooks(OldName).Sheets("BD").Cells(2, rw) = Workbooks(sDir).Sheets("Síntese").Cells(34, 3).Value
Workbooks(OldName).Sheets("BD").Cells(3, rw) = Workbooks(sDir).Sheets("Síntese").Cells(35, 3).Value
Workbooks(OldName).Sheets("BD").Cells(4, rw) = Workbooks(sDir).Sheets("Síntese").Cells(36, 3).Value
Workbooks(OldName).Sheets("BD").Cells(5, rw) = Workbooks(sDir).Sheets("Síntese").Cells(37, 3).Value
Workbooks(OldName).Sheets("BD").Cells(6, rw) = Workbooks(sDir).Sheets("Síntese").Cells(38, 3).Value
Workbooks(OldName).Sheets("BD").Cells(7, rw) = Workbooks(sDir).Sheets("Síntese").Cells(36, 7).Value
Workbooks(OldName).Sheets("BD").Cells(8, rw) = Workbooks(sDir).Sheets("Síntese").Cells(36, 10).Value
Workbooks(OldName).Sheets("BD").Cells(9, rw) = Workbooks(sDir).Sheets("Síntese").Cells(38, 13).Value
Workbooks(OldName).Sheets("BD").Cells(10, rw) = Workbooks(sDir).Sheets("Síntese").Cells(38, 15).Value
Workbooks(OldName).Sheets("BD").Cells(11, rw) = Workbooks(sDir).Sheets("Síntese").Cells(38, 18).Value
Workbooks(OldName).Sheets("BD").Cells(12, rw) = Workbooks(sDir).Sheets("Síntese").Cells(34, 15).Value
Workbooks(OldName).Sheets("BD").Cells(13, rw) = Workbooks(sDir).Sheets("Síntese").Cells(35, 15).Value
Workbooks(OldName).Sheets("BD").Cells(14, rw) = Workbooks(sDir).Sheets("Síntese").Cells(36, 15).Value
Workbooks(OldName).Sheets("BD").Cells(15, rw) = Workbooks(sDir).Sheets("Síntese").Cells(41, 3).Value
Workbooks(OldName).Sheets("BD").Cells(16, rw) = Workbooks(sDir).Sheets("Síntese").Cells(42, 3).Value
Workbooks(OldName).Sheets("BD").Cells(17, rw) = Workbooks(sDir).Sheets("Síntese").Cells(43, 3).Value
Workbooks(OldName).Sheets("BD").Cells(18, rw) = Workbooks(sDir).Sheets("Síntese").Cells(41, 10).Value
Workbooks(OldName).Sheets("BD").Cells(19, rw) = Workbooks(sDir).Sheets("Síntese").Cells(43, 13).Value
Workbooks(OldName).Sheets("BD").Cells(20, rw) = Workbooks(sDir).Sheets("Síntese").Cells(43, 15).Value
Workbooks(OldName).Sheets("BD").Cells(21, rw) = Workbooks(sDir).Sheets("Síntese").Cells(43, 18).Value
Workbooks(OldName).Sheets("BD").Cells(22, rw) = Workbooks(sDir).Sheets("Síntese").Cells(44, 6).Value
Workbooks(OldName).Sheets("BD").Cells(23, rw) = Workbooks(sDir).Sheets("Síntese").Cells(30, 4).Value
Workbooks(OldName).Sheets("BD").Cells(24, rw) = Workbooks(sDir).Sheets("Síntese").Cells(44, 15).Value
Workbooks(OldName).Sheets("BD").Cells(25, rw) = Workbooks(sDir).Sheets("Síntese").Cells(47, 4).Value
Workbooks(OldName).Sheets("BD").Cells(26, rw) = Workbooks(sDir).Sheets("Síntese").Cells(47, 7).Value
Workbooks(OldName).Sheets("BD").Cells(27, rw) = Workbooks(sDir).Sheets("Síntese").Cells(69, 1).Value
Workbooks(OldName).Sheets("BD").Cells(29, rw) = Workbooks(sDir).Sheets("Síntese").Cells(53, 2).Value
Workbooks(OldName).Sheets("BD").Cells(30, rw) = Workbooks(sDir).Sheets("Síntese").Cells(54, 2).Value
Workbooks(OldName).Sheets("BD").Cells(31, rw) = Workbooks(sDir).Sheets("Síntese").Cells(55, 2).Value
Workbooks(OldName).Sheets("BD").Cells(32, rw) = Workbooks(sDir).Sheets("Síntese").Cells(56, 2).Value
Workbooks(OldName).Sheets("BD").Cells(33, rw) = Workbooks(sDir).Sheets("Síntese").Cells(57, 2).Value
Workbooks(OldName).Sheets("BD").Cells(34, rw) = Workbooks(sDir).Sheets("Síntese").Cells(58, 2).Value
Workbooks(OldName).Sheets("BD").Cells(35, rw) = Workbooks(sDir).Sheets("Síntese").Cells(59, 2).Value
Workbooks(OldName).Sheets("BD").Cells(36, rw) = Workbooks(sDir).Sheets("Síntese").Cells(60, 2).Value
Workbooks(OldName).Sheets("BD").Cells(37, rw) = Workbooks(sDir).Sheets("Síntese").Cells(61, 2).Value
Workbooks(OldName).Sheets("BD").Cells(38, rw) = Workbooks(sDir).Sheets("Síntese").Cells(62, 2).Value
Workbooks(OldName).Sheets("BD").Cells(39, rw) = Workbooks(sDir).Sheets("Síntese").Cells(63, 2).Value
Workbooks(OldName).Sheets("BD").Cells(40, rw) = Workbooks(sDir).Sheets("Síntese").Cells(64, 2).Value
Workbooks(OldName).Sheets("BD").Cells(41, rw) = Workbooks(sDir).Sheets("Síntese").Cells(65, 2).Value
Workbooks(OldName).Sheets("BD").Cells(42, rw) = Workbooks(sDir).Sheets("Síntese").Cells(66, 2).Value
Workbooks(OldName).Sheets("BD").Cells(43, rw) = Workbooks(sDir).Sheets("Síntese").Cells(67, 2).Value
Workbooks(OldName).Sheets("BD").Cells(44, rw) = Workbooks(sDir).Sheets("Síntese").Cells(68, 2).Value
Workbooks(sDir).Close SaveChanges:=False
sDir = Dir
Else
Exit Sub
End If
Loop
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 05/12/2013 7:27 am