Results 1 to 1 of 1

Thread: code transfer data from sheet1 to sheet2 and delete some rows with condtion
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    May 2019
    Posts
    60
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default code transfer data from sheet1 to sheet2 and delete some rows with condtion

    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
    Last edited by abdelfattah; Jul 26th, 2019 at 01:38 PM.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •