hello
i found this code from some web it works but when i apply this code another workbook it doesn't transfer all data i changed what i need in my file i no know where is the problem
please anybody help
Code
- Sub TransferData()
- Dim TargetRow As Long
- Dim lastRow As Long
- Dim Rw As Long
- Dim rSource As Range
- lastRow = SHEET2.Cells(Rows.Count, "A").End(xlUp).Row
- TargetRow = SHEET3.Cells(Rows.Count, "A").End(xlUp).Offset(1).Row
- For Rw = 1 To lastRow
- Set rSource = SHEET2.Range(SHEET2.Cells(Rw, 1), SHEET2.Cells(Rw, 8))
- If rSource.Cells(1) <> "" Then
- rSource.Copy
- SHEET3.Cells(TargetRow, "A").PasteSpecial Paste:=xlPasteValues
- SHEET3.Cells(TargetRow, "A").PasteSpecial Paste:=xlPasteFormats
- TargetRow = TargetRow + 1
- End If
- Next Rw
- End Sub