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
Book1.xlsm
Avinash SinghAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fabrice LambertFabrice 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)
    src.Copy
    trg.PasteSpecial xlPasteValues
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Avinash SinghAuthor Commented:
Thnx Fabrice Lambert for giving ur precious time to this post
problem solved
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VBA

From novice to tech pro — start learning today.