lundi 20 avril 2015

Copy values from multiple rows

All I need to do is copy values from different rows, say row A40:D40, A47:D47 etc. I have the code that runs properly for one row at a time, but when I try to do two different rows say A40:D40 and A47:D47 it will copy A40:D40 & A41:D41.

Sub LoopCopyValues()
Dim MyFile As String
Dim FilePath As String

FilePath = "C:\Users\"
MyFile = Dir(FilePath)

Do While Len(MyFile) > 0
    If MyFile = "Master Macro.xlsm" Then
    Exit Sub
End If

Workbooks.Open (FilePath & MyFile)

ActiveWorkbook.Worksheets("A2) Monthly P&L (Source)").Activate


ActiveWorkbook.Close False

Range("B" & Rows.Count).End(xlUp).Offset(1).Select


MyFile = Dir


End Sub

Aucun commentaire:

Enregistrer un commentaire