copy data from sheet 1 and paste to sheet2 by values

copy data from sheet 1 and paste to sheet2 by values
this highlighted colour is only for understanding purpose  in actual file there is no highlighted colour
kindly see the sample file
Avinash SinghAsked:
Who is Participating?
Fabrice LambertConnect With a Mentor Fabrice LambertCommented:
First solution (manual):
Select your source range, copy it (shortcut: ctrl-C).
Select your target range, right click and choose Paste option -> Values.

Second solution (VBA):
Option Explicit

Public Sub test()
    Dim wb As Excel.Workbook
    Set wb = ThisWorkbook
    Dim src As Excel.Range
    Set src = wb.Worksheets("Sheet1").Range("B2:G6")
    Dim trg As Excel.Range
    Set trg = wb.Worksheets("Sheet2").Range("C3")
    copyRangeValues src, trg
    Set src = Nothing
    Set trg = Nothing
    Set wb = Nothing
End Sub

Public Sub copyRangeValues(ByRef src As Excel.Range, ByRef trg As Excel.Range)
    trg.PasteSpecial xlPasteValues
End Sub

Open in new window

Avinash SinghAuthor Commented:
Thnx Fabrice Lambert for giving ur precious time to this post
problem solved
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.