You actually don't need my email address. You have have to create a Google Drive account for yourself to be able to use it.
Mumps,Thank you for the files. I still don't understand what data you want to copy and where you want to paste it. I realize that there is a language barrier, but in order for me to help, I need to know the sheet name that contains the data you want to copy, the cells you want to copy, the sheet name and location on that sheet where you want to paste the data. Please try to explain in detail referring to specific cells, rows, columns and sheets, using a few examples from your data.
Sub CopyData()
Application.ScreenUpdating = False
Dim LastRow As Long, lRow As Long, srcWS As Worksheet, desWS As Worksheet
Set srcWS = Sheets("Consolidado_De_Cargas")
Set desWS = Workbooks("Programação de Cargas D+1.xlsb").Sheets("BD-Planejado")
LastRow = srcWS.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
lRow = desWS.Columns(2).Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
Union(Range("C3:C" & LastRow - 3), Range("B3:B" & LastRow - 3), Range("H3:H" & LastRow - 3), Range("AR3:AR" & LastRow - 3), Range("U3:U" & LastRow - 3)).Copy
desWS.Range("B" & lRow).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Mumps,Try this macro in the Planejado_Matriz_Atualizado.xlsb workbook. Make sure that both workbooks are open. The data will be pasted at the bottom of Sheet "BD-Planejado".
VBA Code:Sub CopyData() Application.ScreenUpdating = False Dim LastRow As Long, lRow As Long, srcWS As Worksheet, desWS As Worksheet Set srcWS = Sheets("Consolidado_De_Cargas") Set desWS = Workbooks("Programação de Cargas D+1.xlsb").Sheets("BD-Planejado") LastRow = srcWS.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row lRow = desWS.Columns(2).Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1 Union(Range("C3:C" & LastRow - 3), Range("B3:B" & LastRow - 3), Range("H3:H" & LastRow - 3), Range("AR3:AR" & LastRow - 3), Range("U3:U" & LastRow - 3)).Copy desWS.Range("B" & lRow).PasteSpecial xlPasteValues Application.CutCopyMode = False Application.ScreenUpdating = True End Sub
I tested the macro using the two files you uploaded and it worked properly without error. If you are using the macro in different files, please upload copies of the files that are giving you the error.
If "Programação de Cargas D+1.xlsb" is not open and you want the macro to open it, I need to know the full path to the folder where that file is saved.