Consulting

Results 1 to 2 of 2

Thread: Code for pasting new data

  1. #1
    VBAX Contributor
    Joined
    Jul 2017
    Posts
    110
    Location

    Code for pasting new data

    Hi,

    Can we have a code where my raw tab data replace Mai tab data and at last we have total intact . Means code will create new rows before total row as per Raw tab data in main tab.

    Sample file attached with name of Var

    Thanks
    Attached Files Attached Files

  2. #2
    VBAX Expert
    Joined
    Sep 2016
    Posts
    788
    Location
    Sub test()
        
        With Sheets("Main")
            Sheets("Raw").Range("A1").CurrentRegion.Copy .Range("A1").End(xlDown).Offset(1)
            .Columns("A:D").RemoveDuplicates Columns:=Array(1, 2, 3, 4), Header:=xlYes
            .Columns("A:D").Sort key1:=Range("A1"), Header:=xlYes
            .Range("D1").End(xlDown).FormulaR1C1 = "=SUM(R2C:R[-1]C)"
        End With
    
    End Sub

Posting Permissions

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