首页 > Excel专区 > Excel教程 >

Vba把Excel某个范围保存为XLS工作薄文件

Excel教程 2022-03-24 23:37:29

  Dim wn$, shp As Shape, arr

  Application.ScreenUpdating = False

  Application.DisplayAlerts = False

  wn = [a1]

  arr = Range("o3:o" & Range("o65536").End(xlUp).Row)

  Sheets("报表").Copy

  With ActiveWorkbook

  With .Sheets(1)

  .Rows("1:2").Delete Shift:=xlUp

  .Range("D:D,P:P").NumberFormatLocal = "@"

  .[o1].Resize(UBound(arr)) = arr

  With .UsedRange

  .Value = .Value

  End With

  For Each shp In .Shapes

  shp.Delete

  Next

  End With

  .SaveAs ThisWorkbook.Path & "" & wn & ".xls", IIf(Application.Version <= 11, xlNormal, xlExcel8)

  .Close

  End With

  Application.DisplayAlerts = True

  Application.ScreenUpdating = True

  MsgBox "ok"


标签: 上一篇下一篇下拉方法excel教程

office教程网 Copyright © 2016-2020 http://www.office9.cn. Some Rights Reserved. 苏ICP备20040415号-9