• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Code for pasting data from other sheet

Veeru106

Member
Hi,

I am looking for some code, which can paste data from one sheet to other sheet just above total row......Sample file attached......in attached file ..I want data to be pasted from Raw tab to Main tab...code should create a rows above total row and accommodate Raw tab data and then again total it....thanks in advance..
 

Attachments

Try This!

Code:
Sub Demo()
Dim LR As Long
Worksheets("Raw").Select
Range("A1").Select: Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Copy
Worksheets("Main").Select
Range("A2").PasteSpecial
LR = Range("D" & Rows.Count).End(xlUp).Row
Range("D" & LR + 1).Formula = "=sum(D2:D" & LR & ")"
MsgBox "Completed"
End Sub
 
Back
Top