技術(shù)員聯(lián)盟提供win764位系統(tǒng)下載,win10,win7,xp,裝機(jī)純凈版,64位旗艦版,綠色軟件,免費(fèi)軟件下載基地!

當(dāng)前位置:主頁 > 教程 > 軟件教程 > Excel教程 >

Vba把Excel某個(gè)范圍保存為XLS工作薄文件

來源:技術(shù)員聯(lián)盟┆發(fā)布時(shí)間:2019-03-19 12:37┆點(diǎn)擊:

  Dim wn$, shp As Shape, arr

  Application.ScreenUpdating = False

  Application.DisplayAlerts = False

  wn = [a1]

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

  Sheets("報(bào)表").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"