I am struggling with this piece of code. I´m not very experienced with VBA so any help is appreciated.
I have already opened the external file I need, now I need to activate the workbook the macro is in and paste the copied row into a new row in the listobject named "data" which is located in the sheet named "data".
This is the piece of the code that's been giving me trouble:
For row = 1 To 100
If Left(Sheets("Resumen").Cells(row, 1).Value, 2) = "MC" Or Left _(Sheets("Resumen").Cells(row, 1).Value, 2) = "LS" Then
Cells(row, 1).EntireRow.Copy
Application.CutCopyMode = False
Set WB2 = Workbooks.Open("C:\Users\peperez\Desktop…
Application.Workbooks("test").Activate
'Set WB2 = ThisWorkbook
Range("D5").ListObject.ListRow.Add (1)
Rows("5:5").Insert
End If
Next row
I have already opened the external file I need, now I need to activate the workbook the macro is in and paste the copied row into a new row in the listobject named "data" which is located in the sheet named "data".
This is the piece of the code that's been giving me trouble:
For row = 1 To 100
If Left(Sheets("Resumen").Cells(row, 1).Value, 2) = "MC" Or Left _(Sheets("Resumen").Cells(row, 1).Value, 2) = "LS" Then
Cells(row, 1).EntireRow.Copy
Application.CutCopyMode = False
Set WB2 = Workbooks.Open("C:\Users\peperez\Desktop…
Application.Workbooks("test").Activate
'Set WB2 = ThisWorkbook
Range("D5").ListObject.ListRow.Add (1)
Rows("5:5").Insert
End If
Next row