Hi dflank
I need test this in my job tomorrow, anyway, before I mark as solved, can you help with more one task?
Sub Stole_this_Code_from_davesexcel()
'http://www.excelforum.com/excel-programming-vba-macros/1063028-copy-related-cells-from-different-workbooks-to-same-workbook.html
'Sorry I stole this code from davesexcel
Dim MyFile As String, Str As String, MyDir As String, Wb As Workbook
Dim Rws As Long, Rng As Range
Set Wb = ThisWorkbook
'change the address to suite
MyDir = "C:\Users\mareco\Downloads\"
MyFile = Dir(MyDir & "cobaia.XLS") 'change file extension
ChDir MyDir
Application.ScreenUpdating = 0
Application.DisplayAlerts = 0
Do While MyFile <> ""
Workbooks.Open (MyFile)
With Worksheets("cobaia")
Rws = .Cells(Rows.Count, "C").End(xlUp).Row
Set Rng = Range(.Cells(1, 1), .Cells(Rws, 44))
Rng.Copy Wb.Worksheets("Relatorio").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
ActiveWorkbook.Close True
End With
MyFile = Dir()
Loop
'----- help me with too, please? ------
With Worksheets("Relatorio")
'After paste data, I need do little thing...
'How to remove all blank rows and keep one single header(Nş NF|Data doc.|Dt.lçto.|CN|Cat. Nota Fiscal|Estornado ...Etc)?
.Range("A:B").Delete
.Range("A1:A" & Range("A65536").End(xlUp).Row).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
.Columns.AutoFit
End With
End Sub
Thank you!!
Bookmarks