Hi
I'm going creazy, because when SAP export to excel file, I don't know why, the file is created with the extension XLS
I need copy data in One tab("cobaia") from file "cobaia.XLS" and paste into file "PasteHere.xlsm"
When I copy data by VBA, something wrong happening, if you look in columns(T,W,X,Y,Z,AA,AC,AD,AE,AF,AG,AI,AJ,AK,AL,AN,AO,AP), the value came with "error" (spaces, not number)
I'm using this code below.
My files size 72Mb, because this, I paste files on GoogleDrive:![]()
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\monica\Downloads\Monica\" 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 End Sub
https://drive.google.com/drive/folde...fE?usp=sharing
Thank you!!
Bookmarks