Search code examples
excelvbacopyformulas

COPY VALUES, NO FORMULAS. EXCEL VBA


I am writting a code to copy a sheet from one workbook(W1) to another workbook(W2). I know how to do it, but the problem is the copied sheet in W2 still has the formulas and references from W1, and I don't want that I just want the values.

This is my code to copy the sheet:

    Set W1 = Workbooks("REPORT1.xlsx")
    Set W2 = Workbooks("REPORT2.xlsx")
    W1.Sheets("TEST").Copy After:=W2.Sheets(wb.Sheets.Count)

Any thoughts. Thanks


Solution

  • Set W1 = Workbooks("REPORT1.xlsx")
    Set W2 = Workbooks("REPORT2.xlsx")
    W1.Sheets("TEST").Copy After:=W2.Sheets(wb.Sheets.Count)
    ActiveSheet.UsedRange.Value = ActiveSheet.UsedRange.Value