问题
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
回答1:
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
来源:https://stackoverflow.com/questions/14981582/copy-values-no-formulas-excel-vba