简体   繁体   中英

Copy entire Excel worksheet without formulas

Any recommendations please? I've tried

Ws = ActiveWorkbook.Sheets(“tab”)
ThisWorkbook.Sheets(“tab”).UsedRange.Value = Ws.UsedRange.Value

but no luck

I would like to copy all of the info over to another file but have tried a few methods but gotten stuck

Give something like this a try:

Sub KopyKat()
    Sheets("original").Cells.Copy
    Sheets("kopy").Cells.PasteSpecial (xlPasteValues)
End Sub

(use your own worksheet names)

EDIT#1:

It is better if the kopy worksheet does not exist when we start:

We will

  • copy the entire worksheet (not just the cells)
  • rename the copy
  • convert all formulas to values



Sub KopyKat2()
    With Sheets("original")
        .Copy after:=Sheets("original")
    End With

    With ActiveSheet
        .Name = "kopy"
        With .UsedRange
            .Value = .Value
        End With
    End With
End Sub

Now kopy also has all the formats as the original as well and column widths, row heights, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM