Results 1 to 2 of 2

Thread: help adjusted code delete empty row when transfer invoice from sheet to another
Thanks Thanks: 0 Likes Likes: 0

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

    Default help adjusted code delete empty row when transfer invoice from sheet to another

    hello,
    my code works but i need adjusted code when i press my macro ignore the empty rows from a19:e31 when delete these rows i suggest to be condition if a19 to a31 =0 then delete theses rows




    HTML Code:
    Sub TransferData()
        Dim Target As Range    
        Dim LastRow As Long    
        Dim R As Long
    
        LastRow = sheet1.Cells(sheet1.Rows.Count, "A").End(xlUp).Row 
        Set Target = sheet2.Cells(sheet2.Rows.Count, "A").End(xlUp)  
    
        For R = 2 To LastRow       
            sheet1.Range(sheet1.Cells(R, 1), sheet1.Cells(R, 5)).Copy _              
                Destination:=Target.Offset(R - 2)        
            With Target.Offset(R - 2, 4)         
                If .HasFormula Then .Value = sheet1.Cells(R, 5).Value       
            End With    
        Next R
        
        On Error Resume Next                ' error if the is a REF error in the sum range    
        Target.Offset(R - 3, 5).Value = WorksheetFunction.Sum(sheet2.Range("E33:E35"))
    
    End Sub
    Last edited by Joe4; Oct 9th, 2019 at 09:16 AM. Reason: fixed code format

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

    Default Re: help adjusted code delete empty row when transfer invoice from sheet to another

    any hlep guys i need it it's necessary

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
  •