abdelfattah
Well-known Member
- Joined
- May 3, 2019
- Messages
- 1,494
- Office Version
- 2019
- 2010
- Platform
- Windows
hi, guys i would help me to code here i have sheet1 from range a2:e91 when i fill data and transfer data to sheet2 i would delete rows which contains cells a =" " then delete also not effect rest of cells like the total because it depends on last rows (the total = a88:a99)
this is my code
[Sub TransferData()
Dim Target As Range
Dim LastRow As Long
Dim R As Long
LastRow = mm1.Cells(mm1.Rows.Count, "A").End(xlUp).Row
Set Target = mm2.Cells(mm2.Rows.Count, "A").End(xlUp)
For R = 2 To LastRow
mm1.Range(mm1.Cells(R, 1), mm1.Cells(R, 6)).Copy _
Destination:=Target.Offset(R - 1)
With Target.Offset(R - 1, 4)
If .HasFormula Then .Value = mm1.Cells(R, 5).Value
End With
Next R
Target.Offset(LastRow, 5).Value = mm2.Range("e91").Value
End Sub
this is my code
[Sub TransferData()
Dim Target As Range
Dim LastRow As Long
Dim R As Long
LastRow = mm1.Cells(mm1.Rows.Count, "A").End(xlUp).Row
Set Target = mm2.Cells(mm2.Rows.Count, "A").End(xlUp)
For R = 2 To LastRow
mm1.Range(mm1.Cells(R, 1), mm1.Cells(R, 6)).Copy _
Destination:=Target.Offset(R - 1)
With Target.Offset(R - 1, 4)
If .HasFormula Then .Value = mm1.Cells(R, 5).Value
End With
Next R
Target.Offset(LastRow, 5).Value = mm2.Range("e91").Value
End Sub
Last edited: