bom dia,
desenvolvi o seguinte código abaixo, porém na linha que está sublinhado esta dando erro," Não e Possível Colar Aqui porque a área Copiar e a área de Colagem não são do mesmo tamanho.", o que fazer?
Importar()
Dim Rota As Workbook, Ano As Workbook, PNP As Workbook, Ade As Workbook
Dim RotaDetalheSintetico As Worksheet, anomalias As Worksheet, PNP_novo As Worksheet, aderencia As Worksheet
Dim PlanDestino, PlanOrigem As String
Dim uLin As Long
Set Rota = ThisWorkbook
Set rngCelula = Range("Bc3:BC20000")
Planilha6.Range("A3:HJ1048576").ClearContents
Workbooks.Open Filename:=("C:Users575622DownloadsRota.xlsx")
Range("B3:BC1048576").Select
ActiveWindow.Selection.Copy
Windows("Rota.xlsx").Activate
Planilha6.Range("A3").PasteSpecial xlPasteValues
uLin = Planilha6.Range("A1048576").End(xlUp).Row
With Planilha6
.Range("BC1:HJ1").Copy
.Range("BC3:HJ" & uLin).PasteSpecial xlPasteFormulas
End With
With rngCelula ' para converter texto em números
.NumberFormat = "General"
.FormulaLocal = rngCelula.Value
End With
Application.CutCopyMode = False
Set Ano = ThisWorkbook
Planilha7.Range("A4:R1048576").ClearContents
Workbooks.Open Filename:=("C:Users575622DownloadsAno.xlsx")
Range("A2:R1048576").Select
ActiveWindow.Selection.Copy
Windows("Ano.xlsx").Activate
[color=#FF0000][u]Planilha7.Range("A3").PasteSpecial xlPasteValues[/u][/color]
uLin = Planilha7.Range("A1048576").End(xlUp).Row
With Planilha7
.Range("S3:AA3").Copy
.Range("S4:AA" & uLin).PasteSpecial xlPasteFormulas
End With
Application.CutCopyMode = False
Set PNP = ThisWorkbook
PlanDestino = ActiveWorkbook.Name
Planilha9.Range("A4:CQ1048576").ClearContents
Workbooks.Open Filename:=("C:Users575622DownloadsPnp.xlsx")
Range("A2:BU1048576").Select
Windows(PlanDestino).Activate
ActiveWindow.Selection.Copy
Windows("PNP.xlsx").Activate
Planilha9.Range("A3").PasteSpecial xlPasteValues
uLin = Planilha9.Range("A1048576").End(xlUp).Row
With Planilha9
.Range("BV3:CQ3").Copy
.Range("BV4:CQ" & uLin).PasteSpecial xlPasteFormulas
End With
Application.CutCopyMode = False
Set Ade = ThisWorkbook
Planilha8.Range("A4:X1048576").ClearContents
Workbooks.Open Filename:=("C:Users575622DownloadsAde.xlsx")
Range("A2:P1048576").Select
ActiveWindow.Selection.Copy
Windows("Ade.xlsx").Activate
Planilha8.Range("A3").PasteSpecial xlPasteValues
uLin = Planilha8.Range("A1048576").End(xlUp).Row
With Planilha8
.Range("Q3:X3").Copy
.Range("Q4:X" & uLin).PasteSpecial xlPasteFormulas
End With
Application.CutCopyMode = False
End Sub
Postado : 26/05/2017 8:08 am