Copy data from one spreadsheet to another

Asked

Viewed 2,677 times

0

I have a problem in one macro, I am trying to copy data from one spreadsheet and paste into another, but this giving an error when doing the insertion of a new line (in yellow).

imagem do erro

Spreadsheets: origem

destino

Code:

Sub copiarDadosEntrePlanilhas()
Application.ScreenUpdating = False
Worksheets(2).Rows("2:2").Insert

'copia de Formulario para Apontamento
    Worksheets("Formulario").Range("B3").Copy Destination:=Worksheets("Apontados").Range("A2")
    Worksheets("Formulario").Range("H3").Copy Destination:=Worksheets("Apontados").Range("B2")
    Worksheets("Formulario").Range("B7").Copy Destination:=Worksheets("Apontados").Range("C2")
    Worksheets("Formulario").Range("H7").Copy Destination:=Worksheets("Apontados").Range("D2")
    Worksheets("Formulario").Range("N3").Copy Destination:=Worksheets("Apontados").Range("E2")
    Worksheets("Formulario").Range("N7").Copy Destination:=Worksheets("Apontados").Range("F2")
    Worksheets("Formulario").Range("N11").Copy Destination:=Worksheets("Apontados").Range("G2")
    Worksheets("Formulario").Range("N14").Copy Destination:=Worksheets("Apontados").Range("H2")
    Worksheets("Formulario").Range("B11").Copy Destination:=Worksheets("Apontados").Range("I2")
    Worksheets("Formulario").Range("H11").Copy Destination:=Worksheets("Apontados").Range("J2")
    Application.CutCopyMode = falso

'Mensagem de texto
    MsgBox "Registro concluído!", vbInformation, "Concluído"
    Application.ScreenUpdating = True

End Sub

error print along with requested information inserir a descrição da imagem aqui

  • 1

    Know which error message shows?

  • nn gave to send the image here

  • @danieltakeshi ready already made the change

  • @danieltakeshi 3rd line "Worksheets("Pointed"). Rows("2:2"). Insert"

  • @danieltakeshi all cells are merged for example the cell between B3 and F4 are merged , and yes the macro belongs to that same spreadsheet.

  • I DID WHAT YOU SAID AND ND

Show 1 more comment

2 answers

1


Try to change the instruction:

Application.CutCopyMode = Falso

for

Application.CutCopyMode = False
  • Wilson, for reply try to give a full answer, when trying to use the comments

  • I couldn’t understand your recommendation

0

For your code to run faster, instead of copy and paste, you could do:

Worksheets("Apontados").cells("A2").value = worksheets("Formulario").cells("B3").value

and repeat this syntax for the other lines of code.

  • Please put recommendations as a comment and insert as responses only that answer the OP question.

  • thank you so much for the tip

  • however I am no longer working in this sector

  • project is stopped

Browser other questions tagged

You are not signed in. Login or sign up in order to post.